Digital PDFs
Documents
Guest
Register
Log In
AA-H485A-TE
November 1979
112 pages
Original
4.8MB
view
download
OCR Version
4.3MB
view
download
Document:
VAX-11 PASCAL User's Guide (Ver 1.0-1)
Order Number:
AA-H485A-TE
Revision:
000
Pages:
112
Original Filename:
OCR Text
November 1979 This document describes how to compile, link, and execute VAX-11 PASCAL programs on the VAX/VMS operating system. It also contains information useful to VAX-11 PASCAL programmers, dealing with input and output, procedure calling, error processing, and storage allocation. VAX-11 PASCAL User’s Guide Order No. AA-H485A-TE SUPERSESSION/UPDATE INFORMATION: This is a new document for this release, OPERATING SYSTEM AND VERSION: VAX/VMS V1.6 SOFTWARE VERSION: VAX-11 PASCAL V1.0-1 To order additional copies of this document, contact the Software Distribution Center, Digital Equipment Corporation, Maynard, Massachusetts 01754 digital equipmént corporation - maynard, massachusetts First Printing, November 1979 The information in this document is subject to change without notice and should not be construed as a commitment by Digital Equipment Corporation. Digital Equipment Corporation assumes no responsibility for any errors that may appear in this document. The software described in this document is furnished under a 1license and may only be used or copied in accordance with the terms of such license. No responsibility is assumed for the use or reliability of software on equipment that is not supplied by DIGITAL or its affiliated companies. Copyright C) 1979 by Digital Equipment Corporation The postage prepaid READER'S COMMENTS form on the last page of this document requests the wuser's «critical evaluation to assist us in preparing future documentation. The following are trademarks of Digital Equipment Corporation: DIGITAL DEC PDP DECUS UNIBUS COMPUTER DECsystem-10 DECtape DIBOL EDUSYSTEM FLIP CHIP FOCAL MASSBUS OMNIBUS 0S/8 PHA RSTS RSX VAX DECnet VMS IAS SBI PDT DATATRIEVE TRAX COMTEX DDT DECCOMM ASSIST-11 LABS INDAC LAB-8 DECSYSTEM-20 RTS-8 TYPESET-8 TYPESET-11 TMS-11 ITPS-10 CONTENTS PREFACE b= * N (S * CREATING AND COMPILING A EXECUTING A PROGRAM VAX/VMS FILE SPECIFICATIONS AND DEFAULTS N THE - PROGRAM COMMAND PASCAL PASCAL L . NNN CHAPTER PASCAL VAX-11 USING NN = CHAPTER COMPILER QUALIFIERS Specifying Qualifiers with the PASCAL A AND - O N | I A PROGRAM CORRECTING T T QUALIFIERS /LIBRARY Qualifier /INCLUDE Qualifier [ FILE wWwWwN QUALIFIERS Debugging and Traceback Qualifiers INPUT - COMMAND Image File Qualifiers Map File Qualifiers ERRORS Error-Related Command Qualifiers SHOW CALLS Command TERMINAL SESSION DA WWWWND - 4.1 4.2 4.3 B Fixed-Length Records Variable-Length Records OPEN PROCEDURE PARAMETERS Buffer Size File Status Record Access Mode iii BB L 1 .3.2 . Access FORMATS N RECORD Organization T Record T = File B NAMES CHARACTERISTICS N . FILE I LOGICAL OUTPUT TR A AND ;oo N SAMPLE INPUT BB WWWNDNDN K FORMAT U = . w N L[] L] W N N b [] S [ Source Code PROGRAM COMMAND LINKER 192 RGNS NGRS RS the WWwWwwwwww LINK LINKER L] N WwwhhNhDNhND - A EXECUTING * (NG EGEG NS in FILES 1=Y N . W N . L] D B . O L * L o e WWwwwwwww LISTING FINDING CHAPTER Qualifiers OUTPUT Source Code Listing Machine Code Listing Cross—-Reference Listing THE > CHAPTER COMPILER LINKING * CHAPTER Specifying SPECIFYING w NN Command CONTENTS Record Type Carriage Control LOCAL INTERPROCESS COMMUNICATION: MAILBOXES COMMUNICATING WITH REMOTE COMPUTERS: NETWORKS (SINGLE, REAL (DOUBLE Type) Types) iv { A wWNH- OO e Jie) Nie ) Jie) e ) Jie) Je) | ) | 1 O | O 1 o0 © i OB WWNDN — ~J NN NNNNNNNNN Double-Precision Floating-Point Data | 1 » o w N+ « [ 5.2 . Single-Precision Floating-Point Data 00 00 00 00 00 OF PROGRAM SECTIONS STORAGE OF SCALAR AND POINTER TYPES STORAGE OF UNPACKED STRUCTURED TYPES STORAGE OF PACKED STRUCTURED TYPES Storage of Packed Sets Storage of Packed Arrays Storage of Packed Records REPRESENTATION OF FLOATING-POINT DATA USE } SYSTEM ENVIRONMENT oo PASCAL EXAMPLES s o] HANDLER [~ CONDITION o o] o 0O o o o & o 0 00 00 00 00 o * HANDLER Establishing and Removing Handlers Parameters for Condition Handlers Handler Function Return Values Condition Values and Symbols Floating-Point Operation VAX-11 Lt WwN - 0 00 Condition Signals Handler Responses WRITING A CONDITION o] N W Nnad « o o L] . = ~J s o o L] o o o o NN NNNNNNNIY RUN-TIME LIBRARY DEFAULT ERROR PROCESSING OVERVIEW OF VAX-11 CONDITION HANDLING B WWWwwwNN - ERROR PROCESSING AND CONDITION HANDLERS o] CHAPTER CALLING RUN-TIME LIBRARY PROCEDURES COMPLETE SYSTEM SERVICE EXAMPLE | NANH Optional Parameters Passing Character Parameters - OO L] L Calling System Services as Procedures Passing Parameters to System Services Input and Output By-Reference Parameters D WNH Parameter Passing Mechanisms By-Reference Mechanism By-Immediate-Value Mechanism By-Descriptor Mechanism Functions and Procedures as Parameters Function Return Values Arguments to PASCAL Subprograms CALLING VAX/VMS SYSTEM SERVICES Calling System Services by Function Reference CHAPTER VTUNT WD STANDARD N CALLING O N = . w . * B WD . VAX-11 PROCEDURE Argument Lists = * L] S = R L AN N N CONVENTIONS | CALLING CHAPTER CONTENTS Page APPENDIX APPENDIX A DIAGNOSTIC MESSAGES A-1 A-1 A-2 COMPILER DIAGNOSTICS A-1 RUN-TIME ERROR A-19 B CONTENTS OF MESSAGES RUN-TIME STACK DURING PROCEDURE CALLS B-1 INDEX INDEX-1 FIGURES FIGURE 1-1 Program 2-1 Compiler 4-1 Source 8-1 Storage Record 8-4 8-2 8-3 Storage of Sample Record Storage of Sample Packed Record Containing Packed Array Single-Precision Floating-Point Data Representation Double-Precision Floating-Point Data Representation Contents of Run-Time Stack During Procedure 8-7 Calls B-2 8-4 8-5 B-1 Development Listing Program of Process 1-2 Format Listing Sample 2-8 Traceback List 4-3 8-8 8-8 8-9 TABLES TABLE 1-1 File 2-1 2-2 PASCAL PASCAL Specification Compiler Qualifiers Command Qualifiers 2-2 2-5 2-3 3-1 4-1 Source Linker /DEBUG Code Qualifiers Qualifiers and /TRACEBACK Qualifiers 2-6 3-2 4-2 5-1 6-1 8-1 8-2 8-3 Predefined System Logical Names Suggested Variable Data Types Program Section Attributes Program Section Usage and Attributes Storage of Scalar and Pointer Types 8-4 Storage of Packed Defaults Array Elements 1-3 5-2 6-10 8-1 8-2 8-3 8-5 PREFACE MANUAL OBJECTIVES The VAX-11 PASCAL User's Guide is intended for use in and 1in compiling and executing PASCAL programs, developing new existing PASCAL on supported PASCAL language elements programs on VAX/VMS systems. VAX/VMS are described in the VAX-11 PASCAL Language Reference Manual. INTENDED AUDIENCE knowledge This manual is designed for programmers who have a working 1is helpful but not Detailed knowledge of VAX/VMS PASCAL. of Some familiarity with the VAX/VMS Primer is recommended. essential; however, (condition handling, for instance) sections of this book, In such require more extensive understanding of the operating system. sections, you are directed to the appropriate manual(s) for the information. required additional STRUCTURE OF THIS DOCUMENT This manual is organized as follows: e Chapter 1 provides an overview of the steps you must follow to e Chapter 2 describes how to compile your program e Chapter 3 supplies information on the VAX-11 e Chapter 4 describes execution commands. e Chapter 5 including create, compile, link, and execute a VAX-11 PASCAL program. the options available at compile time. options, they as apply provides details conventions, 6 and PASCAL programs information about the use of on record discusses to and Linker explains and its PASCAL input/output, file logical names, structure. the conventions followed 1in calling e Chapter e how to Chapter 7 describes error processing, in particular, use the condition handling facility. This chapter is intended procedures, especially the conventions for passing parameters. for users with in-depth knowledge of VAX/VMS. e Chapter 8 describes the relationship between VAX-11 PASCAL and the VAX/VMS operating system, with particular emphasis on data and allocation, storage usage, program section representation. vii e Appendix A summarizes e Appendix B illustrates during ASSOCIATED The For documents contents are relevant VAX-11 PASCAL Primer e VAX-11 PASCAL Language e VAX/VMS Command Language User's e VAX-11 Run-Time Library Reference e VAX-11 Linker e VAX/VMS @ VAX-11 System list of USED document Services Architecture complete IN uses Reference Reference CONVENTIONS words letters THIS the words PASCAL programming: Manual Guide Manual Reference Manual software documents, see the VAX-11 DOCUMENT following conventions. Meaning Uppercase indicate words that as and you letters, should words and examples, indicate that value of your the 1in examples, word or used in letter letters, you are to substitute format a word type the which one choice. Double brackets indicate Square brackets indicate bracket used type shown. Lowercase or I stack Handbook VAX-11 exactly letters run-time Manual Convention and VAX-1l e Lowercase the Primer Directory. and to VAX/VMS Uppercase of calls. e Information This the messages. DOCUMENTS following a procedure diagnostic optional that elements. you must characters. Braces are element is used to to be enclose chosen. 1lists from A horizontal ellipsis indicates that the item(s) can be repeated one or more times. A vertical ellipsis statements in an indicates example viii or preceding that not all figure are shown. of the Meaning Convention S PASCAL $_File: system and enter you commands of examples In responses, all output lines and prompting characters displays are shown in or system prints the that in All the lines you type are shown black letters. red letters. abbreviation 3-character to 1a with A symbol that you press a key on the terminal, for indicates example, GO. ix CHAPTER USING VAX-11 1 PASCAL the PASCAL language. the VAX/VMS operating VAX-11 PASCAL is an extended implementation of The PASCAL compiler executes in native mode under the VAX/VMS VAX-11 operating system. This manual describes how you with interact It contains instructions for compiling, VAX-11 PASCAL. using system on information linking, and executing a PASCAL program, and provides the following topics: e Performing input and e Calling VAX/VMS system services and Run-Time Ldibrary routines e Using the VAX/VMS condition handling facility e Writing efficient output operations VAX-11 PASCAL programs and creating 1in steps the of overview an This chapter provides It also describes the standard program. PASCAL VAX-11 a executing VAX/VMS 1.1 file specification and defaults. CREATING AND EXECUTING A PROGRAM Figure 1-1 illustrates the program development process, from inception to execution. You specify the steps shown in Figure 1-1 by entering commands $ $ $ $ to the VAX/VMS operating system. These commands are: EDIT file-spec PASCAL file-spec LINK RUN file-spec file-spec With each command, you include information that further defines the is importance Of prime system to do. you want the <can You processed. be specification, indicating the file to what file also specify qualifiers that modify the processing performed by the system. USING VAX-11 PASCAL COMMANDS INPUT/OUTPUT FILES PAS $ EDIT AVERAGE. Use the file type of PAS to AVERAGE.PAS indicate the file contains a Create a VAX-11 PASCAL program. source program $ PASCAL AVERAGE The PASCAL command ‘ AVERAGE.OBJ assumes the file type of Compile the an input file is PAS. iy N source program g (AVERAGE.LIS) (If you use the /LIST libraries qualifier, the compiler creates a listing file.) $ LINK AVERAGE The L/NK command assumes the file type of an input file Link the 1s OBJ. AVERAGE.EXE (AVERAGE.MAP) object module (1f you use the /MAP qualifier, the linker creates a map file.) $ RUN AVERAGE Run the The RUN command assumes executable the file type of an image Is Image EXE. Figure 1.2 VAX/VMS FILE A VAX/VMS file or the output following 1-1 Program Development Process SPECIFICATIONS AND DEFAULTS specification file to indicates be the produced. input File file to be processed specifications have the form: node::device:[directorylfilename.filetype;version The punctuation required syntax specification. marks that (colons, separate brackets, period, semicolon) the wvarious components of the are file node Specifies systems a network that support node name. This 1is applicable only to to be DECnet-VAX. device Identifies written. the device on which the file is stored or 1is USING VAX-11 PASCAL directory Identifies the name of the directory under which the file is cataloged, on the device specified. You <can delimit the directory name with square brackets, as shown, or with angle brackets (< >). filename Identifies the alphanumeric file by its characters name; filename can be up to 9 filetype can be up to 3 long. filetype Describes the kind of alphanumeric data characters in the file; long. version Specifies which version of the file 1is desired. Versions are identified by a decimal number, which is incremented by 1 each time a new version of a file is created. Either a semicolon or a period can be used to separate filetype and version. You need not explicitly state all elements of a file specification each time you compile, link, or execute a program. The only part of the file specification that is usually required is the file name. If you omit any other part of the file specification, a default value is used. Table 1-1 summarizes File the default values. Table 1-1 Specification Optional Element Defaults Default Value node Local network device User's current default device directory User's current default directory filetype Depends on node usage: Input to PASCAL compiler Output from PASCAL compiler PAS OBJ Input OBJ to Output Input linker from to linker RUN command Compiler source listing Linker map listing Input to executing program Output from executing program version Input: Output: EXE EXE LIS MAP DAT DAT highest existing version highest existing version plus 1 USING VAX-11l PASCAL If you request compilation of a PASCAL program and you specify only file name, the compiler can process the source program if it finds file with the specified file name that: e Is stored on e Is cataloged e Has a file the default under type of a a device the default directory name PAS If more than one file meets these conditions, with the highest version number. the compiler chooses the one For example, assume directory is SMITH, the that your default device Iis and you supply the following DBAO, your default file specification to compiler: $ PASCAL $_File: CIRCLE The compiler will search device DBAO in directory SMITH, seeking the highest version of CIRCLE.PAS. 1If you do not explicitly specify an object file, the compiler will generate the file CIRCLE.OBJ, store it on device DBAO 1in directory SMITH, and assign it a version number 1 higher than any other version of CIRCLE.OBJ currently cataloged 1in directory SMITH on DBAO. CHAPTER COMPILING After creating compile time, source At code your a and the THE To compile PASCAL a which compiler are input to the files. The listing about compilation listings. 2.1 PROGRAM VAX-11l PASCAL source program, you specify the name of the indicate option, A 2 qualifiers produces you one or you compile it. file(s) containing wish more 1linker (see Chapter 3), files contain source code errors, and optional items to At the use. object files, which and one or more listing 1listings, information such as cross-reference COMMAND source program, use the PASCAL command in the following form: $ PASCAL[/qualifiers] file-spec-listl[/qualifiers] /qualifiers Indicate special processing to be performed by the compiler. file-spec-list Specifies the source file(s) containing the program or module to be compiled. You <can specify more than one source file. If source file specifications are separated by commas, the programs are compiled separated as In one by system signs, the If source file specifications are files are concatenated and compiled program. interactive separate separately. plus mode, line by responds you typing with a can a also enter carriage prompt for the return the file file after specification you type on PASCAL. a The specification: $ PASCAL $_File: Type the file specification the $File: prompt. 2.2 PASCAL COMPILER In many cases, the for compilation. compiler qualifiers and any file of the qualifiers immediately after QUALIFIERS simplest form Sometimes, to specify PASCAL however, special you command will processing. need is to sufficient use PASCAL COMPILING A PROGRAM Table 2-1 lists the qualifiers you can use with the VAX-11 PASCAL You can specify the qualifiers on the command line or in compiler. This section describes the effect of each source code comments. Section 2.2.1 describes how to specify gqualifier on a PASCAL program. specifying with 2.2.2 deals Section qualifiers. line command qualifiers in source code comments. Table 2-1 PASCAL Compiler Qualifiers Can Be Specified in Source Code? Qualifier Purpose CHECK Generates code to perform CROSS_REFERENCE Produces a cross-reference Yes DEBUG Generates records for VAX-11 Symbolic Debugger Yes ERROR_LIMIT Terminates compilation No LIST Produces source listing listing of after identifiers errors 30 Includes representation of machine code in source listing STANDARD WARNINGS Yes file MACHINE_CODE OBJECT Yes checks run-time Yes file Specifies name of No Prints messages indicating Yes Prints diagnostics for Yes object file use of PASCAL extensions warning-level errors CHECK The CHECK qualifier directs the compiler to generate code to perform run-time checks. This code checks for illegal assignments to sets and The system subranges, and out-of-range array bounds and case labels. issues an error message and normally terminates execution if any of these conditions occur. When this qualifier is disabled, the compiler generates no check code. By default, CHECK is disabled. COMPILING A PROGRAM CROSS_REFERENCE The CROSS_REFERENCE qualifier produces a cross-reference listing of all identifiers. The compiler generates separate cross-references for To get complete cross-reference listings each procedure and function. a program, the qualifier must be in effect for all modules of the for being is file 1listing no if ignored This qualifier is program. generated. By default, CROSS_REFERENCE is disabled. You can specify this qualifier in the source code, as described 1in Section 2.2.2. Note, however, that the cross-reference listing for a portion of a procedure or function may be incomplete. DEBUG The DEBUG qualifier specifies that the compiler 1is to generate information for use by the VAX-1ll1 Symbolic Debugger and the run-time error traceback mechanism. When you enable the option, the compiler generates some DEBUG and TRACEBACK records program for which the qualifier is in effect. When this qualifier records. is disabled, By default, DEBUG is for each procedure or the compiler generates only TRACEBACK disabled. ERROR_LIMIT The ERROR LIMIT qualifier terminates compilation after 30 errors, excluding warning-level errors. If this qualifier 1is disabled, compilation continues through the entire unit. You cannot specify this By qualifier default, in the source ERROR_LIMIT is code. enabled. Note that after it finds 20 errors (including warning messages) on any one source line, the compiler generates error 255, Too many errors on this source line. Compilation of the line continues, but no further error messages are printed for that line. LIST The LIST qualifier produces a source listing file. It has the form: LIST[=file-spec] You can include a file specification for the 1listing file. The default file specification designates the name of the first source file, your default directory, and a file type of LIS. The compiler does not produce a 1listing file in interactive mode unless you specify the LIST qualifier. 1In batch mode, the compiler produces a listing file by default. 1In either case, the listing file is not automatically printed. You must use the DIGITAL Command Language (DCL) PRINT command to obtain a 1line printer copy of the listing file. A sample listing is explained in Section 2.4. MACHINE CODE - The MACHINE CODE qualifier places of the object The compiler code generated in the listing by the ignores this qualifier enabled. By default MACHINE CODE is file a representation compiler. disabled. 2-3 if the LIST qualifier 1is not COMPILING A PROGRAM OBJECT The OBJECT qualifier the object file. can It has be used the when you want to specify the name of form: /OBJECT[=file~specl If you omit the file specification, the object file defaults to name of the first source file, the default directory, and a file of OBJ. You cannot specify this qualifier in the source code. You can disable this qualifier when you only want to test the By default, OBJECT is to suppress object source program for code; for compilation the type example, errors. enabled. STANDARD The STANDARD messages at features. Nonstandard qualifier tells the compiler each place where the program PASCAL features that are incorporated VALUE declarations and VAX-11 PASCAL Language By default, STANDARD is are the to uses extensions to print warning-level "nonstandard" PASCAL the PASCAL 1language in VAX-11 PASCAL. Nonstandard features include the exponentiation operator. Appendix C of the Reference Manual lists all the extensions. enabled. WARNINGS The WARNINGS qualifier directs the compiler to messages in response to warning-level (W) errors. generate diagnostic By default, WARNINGS 1is enabled. A warning diagnostic message indicates that the compiler has detected acceptable but unorthodox syntax or has performed unexpected results messages, disable this the STANDARD qualifier Appendix 2.2.1 A A lists specifying PASCAL command the some corrective action; in either case, may occur. To suppress warning diagnostic qualifier. Note that messages generated when is enabled appear even if WARNINGS is disabled. compiler diagnostic Qualifiers with qualifier has the the messages. PASCAL Command form: /qualifier[[=file-spec] Table 2-2 lists the qualifiers you can use on the PASCAL command line. The optional file specification indicates the name of an output file for the OBJECT and LIST qualifiers only. To enable the qualifier, specify 1its name. To disable the qualifier, specify the negative form. You can abbreviate all command line qualifiers by truncating them on the right. All qualifiers are unique when truncated to their first four characters, not including the NO of the negative form. You can truncate further as 1long as the resulting command is unique. For example, you can truncate CROSS REFERENCE to CR, CHECK to CH, and DEBUG to D. - COMPILING A PROGRAM When you use PASCAL command qualifiers in command procedure files, it is recommended that vyou use the full qualifier names to ensure readability. To guarantee compatibility with future releases of the system, fewer you than should four not abbreviate qualifiers in command procedures to characters. Table 2-2 Qualifiers PASCAL Command Qualifier Negative Form Default /CHECK /NOCHECK /NOCHECK /CROSS_REFERENCE /NOCROSS_REFERENCE /NOCROSS_REFERENCE /DEBUG /NODEBUG /NODEBUG /ERROR_LIMIT /NOERROR_LIMIT /ERROR LIMIT /LIST[=file-spec] /NOLIST /MACHINE CODE /NOMACHINE CODE /NOMACHINE CODE /OBJECT[=file-spec] /NOOBJECT /OBJECT /STANDARD /NOSTANDARD /STANDARD /WARNINGS /NOWARNINGS /WARNINGS /NOLIST J/LIST (interactive) (batch) Examples 1. $ PASCAL CALC The source file CALC.PAS is compiled. By default, the STANDARD, WARNING, and ERROR_LIMIT options are enabled. 2. $ PASCAL/CHECK/NOSTANDARD The source generated. language 3. $ CALC file CALC.PAS 1is compiled, and check code is The compiler does not issue warnings for the use of extensions. PASCAL/LIST/CR CALC The source CALC.LIS file CALC.PAS is generated. cross-reference 2.2.2 Specifying is compiled and The listing the file qualifiers Qualifiers have 1listing file includes a listing. in the Source Code You can use qualifiers in the source code to enable special processing during compilation. When specified code, OBJECT, the form: (*$qualifier {+}[,qualifier {i} ;... ]| icomment?) and disable in the source COMPILING The first character after the A comment PROGRAM delimiter must be (S); the dollar sign cannot be preceded by a space. the qualifiers you can specify in your source program. can optionally use a l-character abbreviation is simply the first except for CROSS_REFERENCE, abbreviation Table Code sign 2-3 lists that vyou is X. 2-3 Qualifiers Qualifier Abbreviation CHECK C CROSS_REFERENCE X DEBUG D LIST L MACHINE dollar abbreviation for each qualifier. The character of the qualifier name, whose Source a Table Note CODE M STANDARD S WARNINGS W To enable a qualifier, specify a plus sign (+) after 1its name or abbreviation. To disable a qualifier, specify a minus sign (-) after its name or abbreviation. You can specify any number of qualifiers. You <can from the also list include of a text qualifiers by comment a after the qualifiers, separated semicolon. When specified in the source code, the LIST qualifier cannot contain a file specification. The listing file will have the default specification as described in Section 2.2 above. For example, program, and disable (X$C+ to generate enable it § at CHECK the end enable FROCEDURE check the CHECK code for qualifier of the for only before procedure, TESTLI one the as procedure procedure in a declaration follows: onmluX) TEST1S$ L ENIDs (X$C-idisable CHECKX) Command line qualifiers override example, the source PASCAL/NODEBUG, the 2.3 OUTPUT The the SPECIFYING DEBUG source code specifies option will not code qualifiers. DEBUG+, be in but I£f, you for type effect. FILES compiler produces object files and listing files. You can control production of these files by using the LIST and OBJECT qualifiers with the PASCAL command. Unless you specify otherwise, the compiler generates an object file. In interactive mode, the compiler, by COMPILING default, does qualifier to not generate explicitly A PROGRAM a listing file; you must specify a 1listing file. however, the opposite is true: listing file. To suppress the qualifier. by default, the listing file, you use the In batch LIST mode, compiler produces a must disable the LIST During the early stages of program development, you may £find it helpful to suppress the production of object files until your source program compiles without errors. To do so, specify the NOOBJECT qualifier on the PASCAL command 1line. If you do not specify /NOOBJECT, the compiler generates object e If you specify one source file, e If you specify multiple the source files are file is generated. e If you source You to for can use produce object as follows: one object file is generated. source files, separated by plus concatenated and compiled, and one signs, object specify multiple source files, separated by commas, each file 1is <compiled separately, and an object file is generated e files each source file. both plus signs and commas in the same command 1line different combinations of concatenated and separate files (see Example 4 below). To produce an must specify object file with an explicit file specification, vyou /OBJECT on the PASCAL command line (see Section 2.2). Otherwise, the object file will have the name of 1its corresponding source file and a file type of OBJ. By default, the object file produced from concatenated source files has the name source file. All other file specification attributes directory, and version) assume the default attributes. of the first (node, device, Examples 1. $ PASCAL/LIST AAA,BBB,CCC Source files AAA.PAS, BBB.PAS, and CCC.PAS are compiled as separate files, producing object files named AAA.OBJ, BBB.OBJ, and CCC.0BJ; and 1listing files named AAA.LIS, BBB.LIS, and CCC.LIS. 2. $ PASCAL Source XXX+YYY+ZZZ files compiled as batch mode, 3. XXX.PAS, YYY.PAS, and ZZZ.PAS are concatenated and one file, producing an object file named XXX.0BJ. 1In this command also produces the listing file XXX.LIS. $ PASCAL/OBJECT=SQUARE $ File: CIRCLE The system issues the $_File: prompt because the PASCAL command does not specify a source file. The file CIRCLE.PAS is compiled, producing an object file named SQUARE.OBJ, but no 1listing file. (This example applies to interactive mode only.) 4. $ PASCAL AAA+BBB,CCC/LIST Two object BBB.PAS) files and are CCC.OBJ produced: AAA.OBJ (comprising (comprising CCC.PAS). 1In AAA.PAS interactive this command produces the listing file CCC.LIS. In it produces two listing files: AAA.LIS and CCC.LIS. batch and mode, mode, COMPILING A $ 5. PROGRAM PASCAL ABC+CIRC/NOOBJECT+XYZ When you include a qualifier in a list of files that are to be concatenated, the qualifier affects all files in the list. Thus, the command shown above completely suppresses the object file. That 1is, source files ABC.PAS, CIRC.PAS, and XYZ.PAS will be concatenated and compiled, but no object file will be produced. $ PASCAL/LIST [DIR]MNP The source file MNP.PAS in directory [DIR] is compiled, producing an object file named MNP.OBJ and a listing file named MNP.LIS. The compiler places the object and listing files in the default directory. COMPILER you listing. LISTING FORMAT specify the When LIST qualifier, VAX-11] PASCAL produces a compiler section explains the format of the compiler listing This illustrated EXAMPLE in Figure 11-0CT~-1979 01 11:35:18 11-0CT-1979 LINE NUMEERS 2-1. VAX-11 PASCAL VERSION 11334247 LEVEL FROC STMT STATEMENT. 100 200 1 2 300 400 03 4q . i 1 rrogram lo 1 label 103 var AsByCIiREALS 500 ] 1 600 ) 1 700 800 7 8 1 200 9 WRITELNC(/Enter 2 READLNC(AYR) $ 1200 12 2 C triandle X¥% WARNING = 450! (SARCA) + SQR(E)) Nonstandard 2 2 1 WRITELNC(‘Hurotenuse until FALSES: 1700 17 1 WRITELNC('Dlone’?# 1800 1900 16 18 19 20 Comrilation 2 Errors 1 103 *%X%x ERROR 4 Xk% ERROR 20! 1 1 end. 0 time = 1 . ") "»' Last error(uwarning) on line end ? XX 0.5 ~450 isl Exronentiation ( 12 == b 3§ 17 == //@ "20,*,4<—'@ 2036 xK¥k ‘»C)§ exrected eurected 0.96 seconds Nonstandard feature Active ortions at sides’)$ FPascal! 13 14 15 1600 . if EOLNC(INFUT) then goto 107 1300 1400 1500 #*FAS-F-DIAGN . rereat 2 @2 ZFAS-W~DIAGN . 1 bedin 0 10 11 . PAGE (1) EXAMPLE CINFUT»OUTFUT) ¢ 1000 1100 V1.0-1 DB2:L200»200IEXAMFLE.PAS34 W' 2.4 lines/mirute). 17.@ of comrilation? NonEBUG,STANDARD,LIST,NOCHECK,uaRNINGs.CRDSS_REFERENCE,‘g’ MACHINE._CODE » OBJECT ERROR_LIMIT = 30 Figure 2-1 Compiler Listing Format COMPILING A PROGRAM EXAMFLE 11-0CT-1979 1133518 VAX-11 FASCAL VERSION V1.,0-1 PAGE 2 MACHINE .CODE GENERATED LINE CODE ADDRESS (PRIOR TO BRANCH 0002 MOVAER XVAR(O» FUSHL %0 00 DD 0012 0014 0016 001cC 001E 0020 0023 0025 CLRD PUSHL FUSHL CLRD FUSHL FUSHAL CLRD FUSHL. -(R14) Ri11 #67436548 ~(R14) #0 (R13)BTM-20 -(R14) #0 7E Sk 04 7E 00 EC 7 00 002E 0031 0038 003E 0042 ADDL2 #8s+R14 ADDL2 #5636y (R11) FPUSHAL (R11)RTM8 CALLS #1sFASSINFUT FUSHAL (R11)ERTM8 MOVL 0027 0054 0059 005C 00SE 0065 0069 006D 0071 0078 EXAMPLE 00 00 00 00 00 5O DO #7»8YS$GETJIFI @ #2,FASSOUTFUT R14y(R13)B"-12 (R11)W"236sR10 #16sR14 R10 XVAR(2s 0)sR9 R?r(R14)B74 MOVL CALLS MOVAR 00 00 00 00 00 07 FE SE 6B 08 00 @08 08 00 AR 00 AR €O 00 16 04 8F CO DF 00 00 00 01 FE IF 00 F4 SA SE Sa4 §9 04 00 AD 00 10 Dp 00 AE 00 00 00 02 FE SE IO EC CR 9E €2 #21+(R14)BTM8 #5,PASSWRITESTR (R11)WTM236yR10 #21s(R14)BTM12 11-0CT-1979 11335218 7C DD 05 00 04 8F DD 7C DD AD DF 7C DD 00 EC CB DF CALLS MOVL. MOVAR SUEBL2Z FUSHL MOVAE MOVL MOVL (HEXADECIMALS? READ FROM RIGHT TOQ LEFT) SB 00 00 00 00 00 9E 4) FPUSHAL (R11)W"236 0049 00350 9 0)sR11 R13+s%XVAR(O» CALLS 0045 @ 8 BYTESTREAM 0010 0009 @B OFTIMIZATION) OFCODE OFERANDS oC AE 08 AE 00 00 54 00 00 59 15 15 00 EC VAX~11 PASCAL VERSION V1.0-1 00 00 00 9E DO DO DO 00 00 05 FB CE 9E FAGE 4 CROSS..REFERENCE CROSSREFERENCE LISTING A BQ) c 4 11 1 1 10 4 ¢D4 INPUT QUTPUT GLOBALLY DEFINED 0 0 10 14 REAL 0 11 0 0 12 9 Figure 2-1 4 0 READLN SAR WRITELN compiler e 12@3 13 IDENTIFIERS? EOLN FALSE The 12 11 12 listing 12 13 @ 17 (Cont.) contains Compiler the Listing Format following three Source code listing -- When you specify the source code is listed e Machine code e Cross-reference listing all identifiers wused you must by sections: the LIST listing -- To generate the machine code specify CROSS REFERENCE the qualifier, default. MACHINE CODE qualifier. 1listing, -- To generate cross references for in the program, you must specify the qualifier. The numbers throughout this section are keyed to the numbers in Figure 2-1. ronits ¢ [ iin COMPILING Title title Line -1line Each ists compilation the line Source page of Code the source code the date and listing lines in a contains a line in the under Errors any module leftmost are with the column irrelevant of to S0OS the the edited editor, source PASCAL to the source 1lines in a PASCAL traceback that 1is printed 1if your exception at run time refers to these procedure Statement level level for delimiter. 1level of @ -- The nesting level of statement that and Warnings source code diagnostic description code -- ® A listing. SOS 1line numbers module. The symbolic program encounters an line numbers. that 1listing a declaration. declaration Procedure block. nesting specifies a The level statement The The the it. source code detected by listing the includes compiler. (°) that points to the line where the error was detected numeric code, particular listing, numeric following error the . On A information line beneath on the character position circumflex, the in the specifies the QD . that following lines asterisk (*) that shows source where the compiler number You diagnostics of can use the last these backwards 0 . resumed @ . The line number in which the error was detected . the to detect more than one error translation after the error line of the compiler prints the text that corresponds to each code . Note that one source program error often causes the PASCAL compiler e numbers line in which the error is detected specifies whether the 1is a warning or an error. In addition, the error can contain the following information: A circumflex An source line level of PASCAL structured statements. a comment is the same level as that of follows warnings e ¢ the each 1line of source code after the first BEGIN The statement level starts at 0 and increases by 1 for each statement or title compiler. Procedure level o -- Each line that contains the the the SOS Line numbers 0 -- The compiler assigns unique errors and a and o level 1 indicates declarations in the outermost procedure level number increases by one for each of functions or procedures. e The the The lines of the source code are printed in the 1In addition, the listing contains the following to the source code: PASCAL numbers lists 1line. time of time of source file creation SOS line numbers " -— If you created or line ® title date and ". file specification of the source file appear e a Listing Source Code Listing -source code listing. information pertaining e contains , the the PASCAL compiler name and version number o , specifying VAX/VMS PROGRAM of the listing module name listing page number 2.4.1 Each , page the A line error through containing line the numbers source an to @ error trace listing. and the diagnostic the error COMPILING Summary how -- much generated all At the time end was warning or the errors . Finally, the options 2.4.2 of the required error A source for PROGRAM listing, the messages, the and the source compiler lists the @ . Machine Code the _compiler compilation . compiler If prints line number of status of all tells your a vyou program summary of the the last message compilation the machine MACHINE CODE code listing Listing The machine code qualifier) follows 1listing (if the source requested 1listing. with The contains: e Symbolic representation @ similar to a instruction in one performs VAX-11l MACRO generated. ~— The Because must pass, it branch optimization. the generate Source line number e Hexadecimal address first first ‘E’ -- A appears these instructions optimization of should these not use @ the source -— The address line addresses number hexadecimal of the for before can object debugging marks generated for address 1is the the an instruction. purposes You because they do not correctly correspond to the locations in executable image. The branch optimization mentioned above change the addresses of the object instructions. e it cause deleted. Therefore, these to those appearing in the object instruction that the compiler PASCAL statement on that source line. approximation representation, for each object compiler operates PASCAL Branch certain BRW instructions to be instructions will not be identical executable image. e symbolic instruction, Hexadecimal 1instruction @ -- This is its one-pass instructions operation, the compiler must before it can determine the the can hexadecimal rTepresentation of the object instruction. You should read the hexadecimal instruction from right to 1left because the rightmost byte has the smallest address. Again, because of their as an operands. zeros. The After instruction, compiler but places addresses generating before the of the these operands hexadecimal writing <correct generate some object the address bytes of the wvalues object 1into are printed representation code the file, binary of the object code. 2.4.3 Cross—-Reference The cross-reference qualifier) appears sections: Listing listing after (if the requested with the machine code listing. ® User-specified identifiers e Globally-defined identifiers @ -- This identifiers you declared. @ It REFERENCE contains two —- This section lists all the identifier @ The cross-reference listing does not specify pointer that are used before they are declared. type predefined identifiers that the section the 1lists PASCAL program Each line of the cross-reference listing contains an and CROSS a uses. 1list of the source line numbers where the identifier is used . The first 1line number indicates where the identifier |is declared. Predefined identifiers are listed as if they were declared on line 0. identifiers 2-11 CHAPTER 3 LINKING A PROGRAM object the link you PASCAL program VAX-11 After compiling your Linking resolves all produce an executable image file. to module (s) for addresses references in the object code and establishes absolute locations. symbolic LINK COMMAND THE 3.1 To link an object module, issue the general LINK command in the following form: (s)] file-spec[/file-qualifier(s)...] $ LINK[/command-qualifier /command-qualifier (s) Specify output file options. file-spec Specifies the input object file to be linked. /file-qualifier (s) Specify In input interactive file options. mode, you <can accompanying file specification. issue the LINK command with no The system responds with the prompt: $_File: prompt. the The file specification must be typed on the same line as not fit on one line you can type a does specification file the If next hyphen (-) as the last character of the line and continue on the line. You can enter multiple file specifications separated from each other When used with the LINK command, the comma or plus signs. commas by the no matter which you use, has the same effect as the plus sign: 1If no creates a single executable image from the input files. linker output file is specified, the linker produces an executable image with the same name as the first object module and a file type of EXE. Table 3-1 lists the linker qualifiers of particular users. linker. See the VAX-11] Linker interest to PASCAL Reference Manual for details on the LINKING A PROGRAM Table Linker of Type 3-1 Qualifiers Qualifier Qualifier Negative Form Default Command /BRIEF None Not applicable /CROSS_REFERENCE /NOCROSS_REFERENCE /NOCROSS_REFERENCE /DEBUG /NODEBUG /NODEBUG qualifiers /EXECUTABLE[=file-spec] | /NOEXECUTABLE /EXECUTABLE /FULL None Not applicable /MAP[=file-specl /NOMAP /NOMAP /MAP (interactive) (batch) /SHAREABLE[=£file-spec] /NOSHAREABLE /NOSHAREABLE /TRACEBACK /NOTRACEBACK /TRACEBACK Ipput /INCLUDE=module-~name (s) None Not applicable gtiiifiers /LIBRARY None Not applicable 3.2 LINKER COMMAND QUALIFIERS LINK command qualifiers modify the output of the 1linker and specify whether the debugging or the traceback facility is to be included. Linker output consists of an image file and, optionally, a map file. The following qualifiers, described 1in Section 3.2.1, control the image file generated by the linker: /EXECUTABLE[=file-spec] /NOEXECUTABLE /SHAREABLE[=file-specl The map file qualifiers, described in Section 3.2.2, are: /MAP[=file-spec] /BRIEF /FULL /CROSS_REFERENCE The debugger and traceback qualifiers, ares. ‘ /DEBUG /TRACEBACK described in Section 3.2.3, LINKING 3.2.1 The A PROGRAM 1Image File Qualifiers image file qualifiers include: /EXECUTABLE /SHAREABLE If you do not specify an 1image file qualifier, the /EXECUTABLE; the 1linker produces an executable image. production of an image, specify the negative form, as: default Iis To suppress /NOEXECUTABLE For example: $ LINK/NOEXECUTABLE CIRCLE The file CIRCLE.OBJ 1is 1linked, but no 1image 1is generated. The /NOEXECUTABLE qualifier is useful if you want to verify the results of linking an object file without actually producing the image. To designate /EXECUTABLE a in file the specification for an executable 1image, use generated is form: /EXECUTABLE=file-spec For example: $ The LINK/EXECUTABLE=TEST CIRCLE file CIRCLE.OBJ named is linked, and the executable image TEST.EXE. A shareable image is one that can be used in a number of different applications. It can be a private image vyou use for your own applications, or it can be installed in the system by the system manager for use by all users. To create a shareable image, specify /SHAREABLE. $ For example: LINK/SHAREABLE CIRCLE To include a shareable image as input to the linker, you must use an options file and specify the /OPTIONS file qualifier in the LINK command. Refer to the VAX-11l Linker Reference Manual for details. If you specify /NOSHAREABLE, 3.2.2 the linker generates an executable image. Map File Qualifiers The map file qualifiers tell the linker whether to generate a map file and, if so, the information the map file is to include. The map file qualifiers are: /MAP /BRIEF /FULL /CROSS_REFERENCE 3-3 LINKING The map qualifiers are specified A as PROGRAM follows: /MAP[=file-spec] u{/FULL }H[I/CROSS_REFERENCE]] /BRIEF Note that you must specify /MAP if vyou specify /BRIEF, /FULL, or /CROSS _REFERENCE. The linker uses defaults to generate interactive mode, the default is to the default is to generate the map. or suppress a suppress the map; map in file. In batch mode, If no file specification is included with /MAP, the map file name of the first input file and a file type of MAP. It is the default device, in the default directory. The optional qualifiers /BRIEF and /FULL define information included in the map file, as follows: amount /BRIEF produces a summary of the list of contributing modules. e /FULL produces (1) a summary of the 1image's characteristics and a 1list of contributing modules (as produced by /BRIEF), (2) listings of global symbols by name and by value, and (3) a of characteristics of 1image characteristics of e summary image's the has the stored on sections in the and a linked image. By default, contains a if you specify neither /BRIEF nor /FULL, summary of the' image's characteristics contributing modules (as symbols values, in of the and map file's produced symbol contents, by name /BRIEF), order. refer to plus For the a a the and 1list complete VAX-11] map file a list of of global description Linker Reference Manual. The /CROSS_REFERENCE qualifier can be used with either the default or /FULL map qualifier to request cross-reference information for global symbols. This cross-reference information indicates the object modules that define and/or refer to global symbols encountered during linking. The default is /NOCROSS_REFERENCE. 3.2.3 Debugging and Traceback Qualifiers The /DEBUG be included generated. executes /NODEBUG When qualifier 1in If you under with the the indicates specify the RUN that executable /DEBUG control command. the VAX-11 1image and at of The link the symbolic debugger is to a symbol table to be the program time, debugger, default at link unless time you is is always specify /NODEBUG. vyou specify the /TRACEBACK qualifier, error messages are accompanied by symbolic traceback information showing the sequence of calls that transferred control to the program unit in which the error occurred. If you specify /NOTRACEBACK, this information 1is not produced. The default is /TRACEBACK. If you specify both /DEBUG and /NOTRACEBACK, the traceback capability is automatically included, and /NOTRACEBACK has no effect. LINKING 3.3 LINKER INPUT FILE Input file qualifiers specification. Input specified in an options 3.3.1 The A PROGRAM QUALIFIERS are used as modifiers on files can be object files, file, or library files. the input file shareable images /LIBRARY Qualifier /LIBRARY qualifier has the form: /LIBRARY This qualifier specifies that the input file 1is an object-module library that the 1linker must search to resolve undefined symbols referenced in other input modules. The default file type is OLB. 3.3.2 The /INCLUDE Qualifier /INCLUDE qualifier has the form: /INCLUDE=module-name (s) This qualifier specifies that the input file 1is an object-module library, and that the modules named are the only modules in that library that are to be explicitly included as input. At 1least one module name is required. To specify more than one, enclose the module names in parentheses, and separate them with commas. The /LIBRARY qualifier can input specification. input file file, references. be the used with If specified the you /INCLUDE qualifier use 1library both 1is to modify a qualifiers also searched on for the single same unresolved CHAPTER 4 EXECUTING A PROGRAM can system the program, your 1linked and After you have compiled It has the form: The RUN command initiates execution. execute it. RUN[/[INOCIDEBUG]file-spec $ are default values You must specify the file name; of the file specification. elements optional omit type is vyou if applied The default file EXE. vyou 1if even debugger, the wuse to The DEBUG qualifier allows you omitted this qualifier from the PASCAL and LINK commands (see Sections without executes If you specify /NODEBUG, the program 2.2 and 3.1). This qualifier allows you to override a /DEBUG debugger intervention. qualifier specified at 4.1 link FINDING AND CORRECTING time. ERRORS Both the compiler and the Run-Time Library include facilities for detecting and reporting errors. VAX/VMS also provides the debugger to you In addition to the debugger, help you locate and correct errors. can use a traceback facility to track down errors that occur during program execution. 4.1.1 Error-Related Command Qualifiers At each step in compiling, linking, and executing your program, Yyou qualifiers that affect how errors are reported. command specify can that ensure to /DEBUG qualifier the At compile time, you can use link At debugger. the by use for preserved 1is information symbolic time, you can also specify the /DEBUG qualifier to make the symbolic The same qualifier can be debugger. the to available information specified with the RUN command to invoke the debugger at run time. Table 4-1 summarizes the /DEBUG and /TRACEBACK qualifiers. the in point any at qualifiers these of none use you If compile-link-execute sequence, and an execution error occurs, you will receive a traceback list by default. EXECUTING A PROGRAM Table /DEBUG Qualifier Command /DEBUG PASCAL 4-1 /TRACEBACK and Effect The PASCAL creates needed /DEBUG Qualifiers LINK compiler symbolic by Symbolic Default the /NODEBUG data debugger. data created by the compiler is passed to the debugger. Traceback list also produced. /TRACEBACK | LINK Traceback information passed the to Traceback /DEBUG RUN Invokes DBG> /NODEBUG RUN the needed specified. /DEBUG LINK is is Not If if /TRACEBACK produced. $ was The None displayed. LINK/DEBUG specified command, suppresses is debugger. was the is debugger. list prompt /NODEBUG the in None RUN/NODEBUG DBG> prompt. To perform symbolic debugging, you must use the /DEBUG qualifier with both the PASCAL command and the LINK command. It then is unnecessary to specify it with the RUN command. If you omit /DEBUG from either the PASCAL command or the LINK command, you can use it with the RUN command to invoke the not contain debug will be forced to symbolically. If you specify the event of listing The and the message error, of the list error message, is interpreted by displayed executable image by will in debugging, and you values, rather than is as list in program follows: detected, vyou receive the traceback information. the system, indicating the address at which the Processor Status Longword traceback the list. condition followed is However, and symbol tables used addresses as absolute LINK/NOTRACEBACK, you will receive no traceback error. Figure 4-1 shows an example of a source traceback traceback When the a debugger. records express the In appropriate this the example, nature error occurred (PC), (PSL). This message and is of a the the contents followed by information. The traceback information is presented in inverse order to the routine or subprogram calls. Of particular interest to you are the values listed under routine name and line, the first of which shows which routine or subprogram generated the error. The value given for line corresponds listing to (not a to compiler-generated be confused with line number indicates the nearest begins. Using this information, a short time. If you specify control debugger; of either LINK/DEBUG execution. the traceback If an 1list line number in editor-generated the line source previous line on which you can usually isolate or RUN/DEBUG, error 1is 4-2 not occurs, the automatically The a statement the error in debugger control program numbers). reverts assumes to printed. the To EXECUTING A PROGRAM information, you can use the debugger command SHOW traceback display CALLS, as described in Section 4.1.2. the For more information with VAX-11 PASCAL programs, debugger on using refer to the VAX-11 PASCAL Installation Guide/Release Notes. $ PASCAL/LIST TRACE % TYFE TRACE TRACETEST 01 3-0CT-1979 3-0CT-1979 11321108 VAX~-11 PASCAL VERSION V1.0-1 DELICTEST.FASITRACE.PASH1 (1) 112041 PAGE 1 LEVEL LINE FROC STMT STATEMENT NUMEERS 1 1 2 1 FPROGRAM TRACETEST? 3 2 FROCEDURE F1 4 S & 7 2 BEGIN X $¢= ENDS 8 9 ) 1 0 2 2 (VAR X ¢ REAL)? 1.0/X3 PROCENURE P2 (Y ¢ REAL)? BEGIN 0 1 0 0 0 1 O 0 10 11 12 13 14 15 16 17 Comeilation time = P1CY)$ ENDS REGIN F2¢0.0)% END. 0.+68 seconds ( 1500 lines/minute). Active ortions at end of comerilation? NODEBUG » STANDARD s LIST » NOCHECK » WARNINGS y NOCROSS _REFERENCE » IT = 30 HINE _CODE OBJECTyERROR_LIM NOMAC $ LINK TRACE $ RUN TRACE YSYSTEM-F~FLTDIVs arithmetic trass floating/decimal divide by zero at PC=00000429, FPSL=03C0002A LTRACE-F~TRACERACKy sumbolic stack dume follows module name routine name TRACETEST TRACETEST TRACETEST F1 P2 TRACETEST Figure 4-1 4.1.2 lire relative PC absolute PC 5 10 i4 00000029 00000030 0000004E 00000429 0000045D 000004AC Source Program Listing Traceback List SHOW CALLS Command When an error occurs in a program that is executing under the control To generate a 1is produced. 1list traceback no of the debugger, traceback list, use the SHOW CALLS command, which has the form: DBG>SHOW CALLS EXECUTING 4.2 A SAMPLE TERMINAL simple dialog Username! SMITH Fassword! G A PROGRAM SESSION between you and the system might appear RET WELCOME (Your TO password VAX/UMS VERSION is not displayed) 1.6 $ EDIT CIRCLE.FAS 6D Inerut IDBAZIESMITHICIRCLE . PAS 00100 XE @D (enter source program) (terminate edit session and write CORAZ2ICSMITHICIRCLE .FAS#11] $ $ FASCAL/ZLIST LINK CIRCLE RUN CIRCLE CIRCLE file to disk) as follows: CHAPTER 5 INPUT AND OUTPUT input and output This chapter describes (I/0) for VAX-11 PASCAL. In information about PASCAL I/O in relation to provides it particular, covered topics The VAX-11 Record Management Services (VAX-11 RMS). include: 5.1 e Logical names e PASCAL file characteristics e PASCAL record e OPEN e Local interprocess communication by means of mailboxes e Remote communication by means formats procedure parameters of DECnet-VAX LOGICAL NAMES a The VAX/VMS operating system provides the logical name mechanism as If you use independent. file and device programs making of way on logical names, your program need not specify the particular device which a resides file or the particular file that contains data. Specific devices and files can be defined at run time. A logical name is an alphanumeric string, up to 63 characters long, that you specify in place of a file specification. The operating system provides a number of predefined 1logical names, already Table 5-1 lists the particular file specifications. with associated logical names of special interest to PASCAL users. In addition, the system manager defines the 1logical names PASSINPUT and PASSOUTPUT, which default to SYSSINPUT and SYSSOUTPUT, at compiler installation. Logical names provide great flexibility because they can be associated not only with a complete file specification, but also with a device, a device and a directory, or even another logical name. INPUT AND Table Predefined Name OUTPUT 5-1 System Logical Names Meaning SYS$DISK Default device Default and directory As specified by the user SYSSERROR Default error message SYSSCOMMAND | Default command SYSSINPUT input Default input file User's stream User's terminal (interactive); batch command file (batch) terminal (interactive); batch log file (batch) file User's terminal (interactive); command SYSSOUTPUT Default output file User's . <can create specification a by logical means of name the and terminal command. execution, you can associate the logical names in file specifications appropriate to your needs. $ ASSIGN DBAO:[SMITH]TEST.DAT;2 file associate ASSIGN the This file batch (batch) (interactive); log You file it with Thus, specification OPEN when For it encounters the a before file program your program For example: with DATA command creates the logical name DATA and associates it specification DBAO:[SMITH]TEST.DAT;2. The system uses execution. batch (batch) logical name DATA with this the file program during example: (INDATA, 'DATA', OLD); In executing this PASCAL statement, the system uses the file specification DBAOQ:[SMITH]TEST.DAT;2 for the logical name DATA. To specify a different file when you execute the program again, issue anothér ASSIGN command. For example: $ ASSIGN DBA2:[JONES]REAL.DAT;7 This command associates the specification and replaces OPEN statement above logical the DATA name previous will DATA with logical now a different name assignment. refer to the file The file DBA2: [JONES]REAL.DAT;7. You can also (see the 5.2 FILE A clear and the assign VAX/VMS logical Command names Language with the User's MOUNT and DEFINE commands are organized Guide). CHARACTERISTICS distinction must way are records be made accessed. between the way files INPUT AND The term file arranged on organization a storage applies device. method OUTPUT to the The term way records record are access physically refers to the used to read records from or write records to a file, regardless of the file's organization. A file's organization is specified when the file is created and cannot be changed. Record access is specified each time the file is opened and can vary. 5.2.1 File Organization VAX-11 PASCAL supports consist of records the file (the first the second record on). As 5.2.2 You specify e Direct select the file one record be organization. 1is the second can be added mode as a Sequential in which they first record record only at in the are in the end files written to the file, file, and the file. of so two ways of parameter accessing to the OPEN procedure. records: sequential file, record Sequential access provides Sequential you written records record PASCAL file Access ® from can result, Record VAX-11 If a sequential arranged in the order record written is the access mode, records are written to or read starting at the beginning and continuing through the after another. access to only after written only select direct a file means reading at the all end that the of you records a file can read preceding that is a particular it. open New for records sequential access. If you records are relative record RECORD Records You are indicating a and only open for stored Fixed @ Variable can you can FIND the record file if is input access in one of fixed-length When you specify specifying that A file to order in must include be read. fixed-length which the You can records, (reading). two formats: length Fixed-Length records, the call length Variable-length bytes. to contains it records records in can mode. 5.3.1 specify procedure FORMATS e mode. mode, Each number directly access resides on disk, 5.3 access accessed. sequential accessed only or in direct sequential Records fixed-length all opened allow either be the records records for in direct record the (see Section file contain access location 5-3 to must be 5.4.4), the contain computed you same are number of fixed-length correctly. INPUT AND 5.3.2 OUTPUT Variable-Length Records Variable-length records can contain any number of bytes, up to the buffer size specified when the file was opened. Variable-length records are prefixed by a count field, indicating the number of bytes in the record. The count field comprises two binary bytes on a disk device and four decimal digits on magnetic tape. The value stored in the count field indicates the number of data bytes in the record. 5.4 OPEN PROCEDURE PARAMETERS This section supplements the description of the OPEN procedure that appears in the VAX-11 PASCAL Language Reference Manual. In particular, it describes how the VAX-11 Record Management Services (RMS) affect VAX-11 PASCAL. For more information, refer to the VAX-1l1 Record Management Services Reference Manual. The OPEN procedure OPEN has the (file-variable, following 'VAX/VMS general file format: specification', file-status, record-access-mode, carriage-control); buffer-size, record-type, Buffer size, file status, record access mode, carriage <control are RMS-dependent attributes record type, described in and this section. 5.4.1 The Buffer buffer Size size parameter record size in bytes for text file is 133 bytes. has no is an integer a text file. For a file of that specifies The default for any other type, the maximum a VAX-11 PASCAL this parameter meaning. 5.4.2 File Status The file status parameter indicates whether the specified file exists or must be created. The possible values for this parameter are: NEW OLD A file type of NEW indicates that a new file must be created with specified characteristics. NEW is the default value. If you specify OLD, the system tries to open an existing error occurs 1f the file cannot be found. A type of OLD for internal files, which are newly created each time the program 5.4.3 unit Record The record records in is DIRECT file. An is illegal declaring executed. Access Mode access mode parameter specifies the mode of access the file. The possible values for this parameter are: SEQUENTIAL the to INPUT AND OUTPUT The can default record access mode is SEQUENTIAL. In SEQUENTIAL mode, access files that have fixed- or variable-length records. DIRECT mode fixed-length records 5.4.4 The in allows you to records. DIRECT Record mode. use the FIND procedure You cannot access a The read files with file with variable-length Type record type parameter specifies file. to you possible values for this the structure parameter of records in a are: FIXED VARIABLE A value of FIXED indicates that all records in the file have the same length. A value of VARIABLE indicates that the records within the file can vary in length. VARIABLE is the default for a new file. For an existing file, the default is the record type associated with the file at 5.4.5 The in its creation. Carriage Control carriage control effect for an parameter parameter specifies output text file. the type of carriage The possible values control for this are: LIST CARRIAGE NOCARRIAGE A value of LIST indicates that each record will be preceded by a 1line feed and followed by a carriage return when the file is output to a terminal or line printer. LIST is equivalent to the VAX-1ll RMS record attribute CR. LIST is the default for all text files. A value of CARRIAGE indicates that the contains a carriage control character. VAX-11 RMS record attribute FTN. first byte CARRIAGE is of each equivalent record to the A value of NOCARRIAGE indicates that the record contains no carriage control information. NOCARRIAGE 1is equivalent to the VAX-1l1l RMS record attribute PRN with all bits equal to zero. 5.5 LOCAL INTERPROCESS It is often useful to synchronize A mailbox is a to COMMUNICATION: exchange data execution or to record-oriented, send MAILBOXES between processes: for example, messages. pseudo I/0 device that allows data to be passed from one process to another. Mailboxes are created by the Create Mailbox (SYSSCREMBX) system service (see Section 6.2.1 for an example using SYSS$SCREMBX). This section describes how to send and receive data using mailboxes. Data transmission by means of mailboxes is synchronous; that 1is, a PASCAL program that writes a message to a mailbox must wait until that message is read, and a program that reads a message from a mailbox INPUT AND must wait until the mailbox, an a message is end-of-file program. VAX-1l before returns For it RMS written. When «condition 1is ensures control OUTPUT to the writing program closes returned to the reading that the message the user program. transmission is complete example: FROGRAM MAIL VAR MEX (MBXs OQUTFUT) 1 TEXTS OFEN (MEBXy REGIN RESET WHILE ‘MAILBOX‘y (MEX)3 NOT EOF (MEX) OLDy SEQUENTIAL) DO BEGIN WHILE NOT EQLN BEGIN WRITE (MEX) DO (MRXTM)3$ GET (MEX) END WRITELNS GET (MEX) END? CLOSE (MEX) END, This program reads messages MAILBOX. The the terminal. user's 5.6 If messages COMMUNICATING WITH your computer VAX-11 PASCAL network. at the files at is computer task-to-task different to allow from a DECnet communicate you to (resource communication That in is, local which and these the are logical then name printed at NETWORKS network, with exchange (task-to-task remote computer transparent. be nodes the known by text, of procedures remote are of COMPUTERS: procedures the mailbox lines REMOTE These Both to one 1I/0 from a are you other data with communication) can nodes a and use in the program to access sharing). resource sharing intersystem interprocess and between exchanges file-access To communicate across the network, specify a node element of a file specification. For example: name do systems not appear exchanges. as the first BOSTON: :DBAQ: [SMITH] TEST.DAT; 2 Remote task-to-task communication specification. You must use name the task name, and supply the as requires notation in the a TASK= special in following form place of of the file device example: BOSTON: : "TASK=UNA" The example specifies the task named fragment shows UPDATE on the BOSTON node of the received from network. The a following remote program program by means of VAX-1l how messages PASCAL I/0 can be procedures. INPUT AND OUTPUT OFEN (NETJORy ‘RBOSTONZI:*TASK=UNA"'»OLD)# RESET (NETJOR) 3 RDAT (= NETJOBTM S NET..FROC (RDATsWRTDATY S CLOSE (NETJOR) S The effect of these statements is to establish a 1link with a Jjob (TASK) named UNA at the node BOSTON and to receive a component from the file variable associated with the remote program. The variable RDAT contains the data. Then the procedure NET_PROC is called to process the data and the link is broken. The next example shows how you can write a PASCAL I/0 remote file wusing VAX-11 procedures. FROGRAM UFDATE VAR (NEWDATy RBRANCH) s NEWDAT ¢ FILE OF INTEGERS$ BRANCH ¢ FILE OF INTEGERS$ REGIN OFEN (NEWDATy "NEWDAT.DAT »OLIDD 5 RESET (NEWDAT) OFPEN (BRANCHy 'NASHUA"PLUGH REWRITE (BRANCH) WHILE NOT EOF (NEWDAT) XYZZY" ! IMASTER.DAT s NEW) 5 D0 BEGIN BRANCHTM : =NEWLATTM § GET FUT (NEWDAT) (BRANCH) END CLLOSE (BRANCH) 3 CLOSE (NEWDAT) END. The sample program writes records in a remote file at the node NASHUA. It reads data from a local file known by the logical name NEWDAT and writes the data across the network to the remote file MASTER.DAT 1in the directory [PLUGH] with password XYZZY. If you use logical names in your program, you can equate the logical names with either 1local or remote files. Thus, if your program normally accesses a remote file, and the remote node becomes unavailable, you can bring the volume set containing the file to the local site. You <can then mount the volume set and assign the appropriate Remote logical name. For example: Access $ ASSIGN REM::APPLIC SET:file-name Local LOGIC Access $ $ MOUNT device-name APPLIC_SET ASSIGN APPLIC SET:file-name LOGIC The MOUNT and ASSIGN commands are described Command Language User's Guide. DECnet capabilities are described in in detail in the VAX/VMS the DECnet-VAX Reference Manual. CHAPTER CALLING 6 CONVENTIONS In the context of the VAX/VMS operating system, a procedure is a routine entered by a CALL instruction. 1In a PASCAL program, such a routine can be a function or procedure written in PASCAL, a function or procedure written in some other language, a VAX/VMS system service, or a VAX-11l Run-Time Library procedure. In many cases, procedures perform calculations that are used widely and repeatedly in many applications. 1In PASCAL, you can write each procedure once and call it from many other programs. This chapter describes how to call procedures that are not written in PASCAL and provides information on calling VAX/VMS system services and VAX-11] Run-Time Reference functions Library Manual and for procedures. See the information on defining VAX-11] PASCAL and Language invoking PASCAL procedures. The material presented here assumes some knowledge of procedure calling and argument passing mechanisms. You should be familiar with these subjects before you attempt to use the features described in this chapter. Refer to the VAX-11 Run-Time Library Reference Manual and the VAX-11 Architecture Handbook for more information. 6.1 VAX-11l PROCEDURE CALLING STANDARD Programs compiled by the VAX-11 PASCAL compiler conform to the standard defined for VAX-11 procedure calls (see Appendix C of the VAX-11 Architecture Handbook). This standard prescribes how arguments are passed, how function wvalues are returned, and how procedures receive and return control. VAX-11] PASCAL also provides features that allow programs to call system services and procedures written in other native-mode languages supported by VAX/VMS. VAX-11 PASCAL uses the VAX-1l CALLS instruction to <call procedures. The illustrations in Appendix B outline the events that occur during a procedure call and show the structure of the run-time stack after each event. 6.1.1 Argument Lists Each time you call a procedure, VAX-11 PASCAL constructs an argument list. The VAX-11 procedure calling standard defines an argument list as a sequence of longword (4-byte) entries. The first byte of the first entry in the list is an argument count, which indicates how many arguments follow in the list. CALLING CONVENTIONS The arguments in the 1list are based on specified in the formal parameter list and parameter list. The argument list contains the the the passed to . 6.1.2 Parameter the procedure. passing mechanisms values in the actual arguments actually Passing Mechanisms Non-PASCAL procedures require arguments as addresses, immediate values, or descriptors. The VAX-11l procedure calling standard defines three mechanisms by which arguments are passed to procedures: The 1. By-reference value 2. By-immediate-value 3. By-descriptor descriptor of following VAX-11 the argument -- the list program describe to using each of pertains only entry argument -- the argument the value subsections PASCAL subprograms information -- list what correctly is the list entry entry is you pass must address is the the to in passing PASCAL Langquage between PASCAL these mechanisms. Note that to subprograms written in languages Reference Manual for a description of of a vyour non-PASCAL than PASCAL. For information about passing arguments to subprograms from non-PASCAL programs, see Section 6.1.5. Refer VAX-11 the value address specify arguments of this other PASCAL to the parameter subprograms. 6.1.2.1 By-Reference Mechanism - The by-reference mechanism passes the address of the actual parameter. By default, PASCAL uses this mechanism for everything except dynamic array parameters. You can invoke the by-reference mechanism in two ways: 1. By omitting list. This the mechanism specifier from the formal parameter syntax invokes PASCAL by-value semantics. 2. By using the VAR specifier This syntax invokes PASCAL in the formal parameter by-reference semantics. 1list. If you actual omit the mechanism specifier, PASCAL passes the address of the parameter. PASCAL expects the called procedure to copy the value from the specified address to local storage. You should use this method only if the called procedure does not change the value of the corresponding actual parameter. When vyou omit the mechanism specifier, the actual For example, the function call use FUNCTION TANH := parameter must following function this method: MTHSTANH MTHSTANH (ANGLE : be an expression. declaration REAL) :REAL; and corresponding EXTERN; (RADIANS); This example declares the VAX-11 Run-Time Library function MTHSTANH as an external subprogram. The MTHS TANH function returns, in floating-point notation, the hyperbolic tangent of an angle. The input parameter to this function 1is the size of the angle (in radians), and it must be passed by-reference. Because the function MTHSTANH does not change the value of the angle, you can omit the mechanism specifier when you declare the function. The returned value CALLING is assigned (See Section to 6.3 CONVENTIONS the variable TANH by the assignment statement shown. for more information on calling Run-Time Library procedures.) Use the VAR specifier to pass an actual parameter that can change in value during execution of the procedure. You must use VAR when passing a file variable as a parameter. The VAR specifier 1is also useful to prevent the copying of large parameters. Specify VAR in the following VAR format: formal-parm-list : type ; The formal parameter list specifies one or more formal parameters of the indicated type. Each of these parameters will be passed using the by-reference mechanism and with by-reference semantics. When you call the procedure, the argument list contains the address of the value to be passed. The actual parameter must be a variable or a component of an unpacked, structured variable; constants, expressions, The pass procedure names, following declarations an address to TYPE BIT64 VAR SYSTIME FUNCTION STATUS = an ARRAY allowed. function call show how to routine. [1..2] OF BOOLEAN; BIT64; SYSSGETTIM := function names are not and corresponding external PACKED : and (VAR SYSSGETTIM BINTIM : BIT64) : INTEGER; EXTERN; (SYSTIME) ; This example declares the Get Time (SYSSGETTIM) system service, returns the system time. The actual parameter SYSTIME is a variable into which the system service writes the time. which 64-bit 6.1.2.2 By-Immediate-Value Mechanism - VAX/VMS system services and Run-Time Library procedures sometimes require that the calling program pass an immediate value, that is, the value itself. To direct PASCAL to pass a value instead of an address, use the %IMMED mechanism specifier, as $IMMED follows: formal-parm-list : type The formal parameter list specifies one or more formal parameters of the 1indicated type. Variables that require more than 32 bits of storage, including all file variables, cannot be passed as immediate values. You can use %IMMED only with non-PASCAL subprograms. When you call the procedure, the actual parameter 1list contains the value of each parameter for which you specified $IMMED. The actual parameter can be a constant, a variable, or an expression. Note that $IMMED can also modify procedure and function names, as described in Section The 6.1.3. following declarations and corresponding pass an VAR immediate value EVENT_FLAG FUNCTION STATUS := : to a function call show how to system service procedure. INTEGER; SYSSWAITFR SYSSWAITFR ($IMMED EFN : (EVENT_FLAG); 6-3 INTEGER) : INTEGER; EXTERN; CALLING This example declares the Wait system service, which waits requires one value parameter, CONVENTIONS for for the to wait. This number is passed integer variable EVENT FLAG. Single Event Flag (SYSSWAITFR) a single event flag. SYSSWAITFR number as an of the event immediate flag value, for copied which from the 6.1.2.3 By-Descriptor Mechanism - The by-descriptor mechanism passes the address of a string, array, or scalar descriptor, as described in Appendix C of the VAX-11 Architecture Handbook. VAX-11 PASCAL includes the $STDESCR mechanism specifier for passing string descriptors and the $%DESCR mechanism specifier for passing array and scalar descriptors. You cannot pass a component of a packed structure using either of these specifiers. You can use these specifiers only with array non-PASCAL descriptor subprograms. Note that, by default, to a formal dynamic array parameter. PASCAL passes an To pass a string descriptor, specify %$STDESCR as follows: $STDESCR formal-parm-list : type; The formal parameter list specifies one or more parameters of the indicated type. Only string constants, packed character arrays with subscripts from 1 to n, and packed dynamic character arrays with subscripts of an integer or integer subscript type can be passed by string descriptor. When you call string each system the procedure, the descriptor. For service TYPE VAR requires PACKED ARRAY[1..80] PACKED ARRAY([1l..6] : FUNCTION STATUS The %STDESCR by string scalar in the The or type. in other : MSGTYPE; DEV : DEVTYPE) : INTEGER; EXTERN; (MESSAGE, 6 or list or array unpacked array argument scalar list variable. TERMINAL); that actual both high-level an : parameters parameters characters, formal-parm-list parameter an CHAR; CHAR; MSG The written The parameters: $STDESCR descriptors. To pass following format: scalar OF OF as (%STDESCR indicates and formal array specifier 80 indicated type SYSSBRDCST of $DESCR the address of Broadcast (SYS$SBRDCST) DEVTYPE; descriptor. arrays contains the MSGTYPE; : SYSS$SBRDCST := list descriptors DEVTYPE MESSAGE Routines string MSGTYPE TERMINAL packed two argument example, MESSAGE must and be passed TERMINAL are respectively. languages array or may scalar require descriptor, array use or $%DESCR type specifies one type. The (fixed or contains or type dynamic) the more can be of address of parameters of the any predefined scalar a scalar predefined the descriptor of an CALLING The a CONVENTIONS following example shows how an array descriptor might be passed to FORTRAN subroutine. TYPE FORAY = ARRAY PROCEDURE FORMATRIX [1..10,1..10] OF CHAR; (%$DESCR ARRDES : FORAY); FORTRAN; The FORTRAN subroutine FORMATRIX expects the array to by-descriptor. A call to FORMATRIX might be the following: FORMATRIX be passed ; (CHARARR) The actual parameter CHARARR specifies a character array, and the argument 1list contains the address of a descriptor for this array. (Note that VAX-11 FORTRAN treats character parameters as CHARACTER¥*1 variables.) 6.1.3 Functions and Procedures as Parameters You can pass procedure and function names as immediate wvalues routines written in other languages, using the following format: to $IMMED PROCEDURE procedure-name-list $IMMED FUNCTION function-name-list The procedure name list specifies the procedure parameters. The function one or more formal function parameters corresponding actual parameter lists procedures For and functions to be passed FORCALLER (%$IMMED : type name of one or more formal name list specifies the name of of the indicated type. The specify the names of the actual as parameters. example: PROCEDURE PROCEDURE UTILITY); FORTRAN; The FORTRAN subroutine FORCALLER calls a PASCAL procedure and requires that the name of the procedure be passed as an immediate value. The argument list contains the address of the PASCAL procedure's entry mask. A call FORCALLER to the FORTRAN (PRINTER); Any subprogram passed with and those procedure might be: declared at $IMMED should access only its own variables program level. For information on passing procedure and function names between PASCAL subprograms, see the VAX-11 PASCAL Language Reference Manual. 6.1.4 Function Return Values A function returns a value to the calling program value to the function's name. or pointer type; which a value is by The value must be a structured types are not returned depends on its allowed. type, assigning scalar, The that subrange, method as listed below. by CALLING CONVENTIONS Type Return Method Integer, single, real, General Register RO character, Boolean, pointer, user-defined scalar Double 6.1.5 When Low-order result High-order result Arguments to PASCAL Subprograms calling must RO0: Rl: a ensure VAX-11 PASCAL PASCAL subprogram from that the arguments are expects most parameters a non-PASCAL in the correct to be subprogram, form. you By default, passed by-reference. For a PASCAL value parameter (declared without a mechanism specifier), the argument 1list must contain the address of the value. The PASCAL subprogram will copy the value from the passed address upon entry. For a VAR parameter, the argument list must contain the address of the variable. The subprogram does not copy the value, but instead uses the address to access the actual parameter variable. Actual parameter variables that can change in value as a result of subprogram execution must be passed in this manner. 1In addition, all files must be passed as PASCAL VAR parameters. For a formal procedure or function parameter (indicated by the PROCEDURE or FUNCTION specifier), the argument list must specify the address of the bound procedure value, which consists of two longwords. The first 1longword contains the address of the entry mask for the subprogram; the second longword contains the environment pointer. (This process implements the VAX-11 by-reference mechanism for a procedure or For a the address 6.2 function.) formal dynamic array parameter, of an array CALLING VAX/VMS the argument list must contain descriptor. SYSTEM SERVICES You can declare any VAX/VMS system service as an external function or procedure and then call it from your PASCAL program. When declaring a system service, specify an identifier in the following form: SYSS$service-name For example, the name of the S$SFAO system service is SYSSFAO. You pass parameters to the system service according to its particular requirements: a value, an address, or the address of a descriptor may be needed, as described in Section 6.1.2. To 1invoke the system service, use a function or procedure call in the VAX/VMS System Services Reference Manual each service. system your for a PASCAL program. See full description of The system provides three files containing condition symbol definitions. When vyou declare a system service or Run-Time Library procedure, you should specify the appropriate file in the CONST section to define the condition values in your PASCAL program. Use CALLING the $INCLUDE directive VAX-11 The and PASCAL Language to CONVENTIONS specify the file name, as described in the Reference Manual. three files are SYSSLIBRARY:LIBDEF.PAS, SYS$SLIBRARY:MTHDEF.PAS, SYSSLIBRARY:SIGDEF.PAS, as described below. SYSSLIBRARY:LIBDEF.PAS This file contains definitions for all condition symbols from the general utility Run-Time Library procedures. These symbols have the form: LIBS xyz For example: LIBS_NOTFOU SYSSLIBRARY:MTHDEF.PAS This file contains definitions for all mathematical procedures library. These condition symbols from symbols have the form: the MTHS Xyz For example: MTH$_SQUROONEG SYSSLIBRARY:SIGDEF.PAS This file contains miscellaneous handlers. These symbols have the symbol definitions form: used in condition i SS$_xyz For example: SS$_FLTOVF 6.2.1 Calling System Services by Function Reference In most cases, you will want to declare a system service as a function so that you can check its return status. Each system service returns a VAX-11 condition value indicating whether completion was successful. These condition values can be interpreted as 1integer codes that correspond to symbolic names such as SS$ ACCVIO. 0dd codes indicate successful completion and even codes indicate failure. For example, Mailbox the following procedure (SYSSCREMBX) system service. defines and calls the Create CALLING CONVENTIONS FROCEDURE CREATE_MAILEOXS$ CONST ZINCLUDE ‘SYS$LIBRARYISIGIEF.FAS’ TYFE STATUS = (INT_.STATy» BOOL.STAT)# WORD = 0..6355357% SURSZ = 1..637 CHAN_STAT = (INT_.CHAN,DUMMY.CHAN)? CHAN.TYPE = PACKED RECORD CASE CHAN.STAT OF INT.CHAN ¢ (CHAN_NO ¢ INTEGER)S$ DUMMY.CHAN ¢ (BOT_.CHAN ¢ WORID) ENDs VAR MEX.REC $: RECORD ) CASE STATUS OF INT.STAT ¢ (MEX.INT ¢ INTEGER)? ROOL_STAT ¢ (MEX._.ROOL : ROOLEAN) ENDs CHAN_REC ¢! CHAN._TYFE? FUNCTION SYS$CREMBX (XZIMMED FPRMFLG ¢ INTEGERS VAR CHAN : CHAN..TYFE? »IMMED MAXMSGs BUFQUOy FROMSKs ACMODE : INTEGERS? YSTOESCR LOGNAM ¢ FACKED ARRAY L[SURG31 OF CHAR): INTEGER$? EXTERN# BEGIN WITH MBX.REC DO BEGIN )7 s0s0» MAILBOX MEX_INT = SYS$CREMEX(OsCHAN_REC»0+0 IF NOT MBX.EOOL THEN BEGIN WRITELN (‘Error when truing to create mailbox’)s HALT END END END§ The function reference allows a return status to be stored 1in the record MBX REC. If the function's return status is false (represented by any even integer), indicating failure, an error occurs and error You can also check for a particular processing can be undertaken. s, by comparing the return privilege of return status, such as lack status to one of the status codes defined by the system. For example: IF MBX_REC.MBX_INT = SS$_NOPRIV THEN WRITELN ('No privilege to create mailbox'); Refer to the VAX/VMS System Services Reference Manual for about return status codes. The described with each system service. relevant information return status codes are CALLING 6.2.2 Calling CONVENTIONS System Services as Procedures If you do not need to check the return status, you can declare a system service as an external procedure rather than an external function. Procedure calls to system services are made in the same way that «calls are made to any other procedure. For example, Create Mailbox system service, define and call the SYSSCREMBX, as to use the procedure follows: PROCEDURE SYSSCREMBX (%IMMED VAR PRMFLG CHAN : : INTEGER; CHAN_TYPE; $IMMED MAXMSG, BUFQUO, PROMSK, ACMODE : INTEGER; $STDESCR LOGNAM : ARRAY [SUB63] OF CHAR); EXTERN; SYSSCREMBX (0,CHAN_REC,0,0,0,0, You should declare CHAN_REC MAILBOX') ; and CHAN TYPE as in the previous section. This procedure call corresponds to the function reference, but does not allow you to test the status code returned by the system service. 6.2.3 Most Passing Parameters system services to System Services require input parameters to be passed as immediate values. When declaring these parameters, you must use the $IMMED mechanism specifier. Some system services, however, require input parameters to be passed by-reference. For input parameters passed by-reference, you should use the default (that 1is, omit the mechanism specifier) so that actual parameters can be expressions. In addition, most system services require output parameters to be passed by-reference. For these parameters, you must use the VAR mechanism specifier to ensure that PASCAL correctly interprets the output data. The VAX/VMS System Services Reference Manual lists the mechanism by which each parameter to a system service must be passed. 6.2.3.1 Input and Output By-Reference Parameters - You will often need to tell the system service where to find input values and where to store output values. Thus, you must ascertain the hardware data type of the parameter: byte, word, longword, or quadword. For input parameters that refer to byte, word, or longword values, you can specify either constants or variables. If you specify a variable, it must be of a type that is allocated an equal or greater amount of storage than is allocated to the hardware data type required. For output parameters, you must declare a variable of exactly the length required, to avoid including extraneous data. For example, if the system returns a byte wvalue in a word-length wvariable, the leftmost eight bits of the variable will not be overwritten on output and the variable will not contain the data you expect. Table 6-1 lists the suggested input and output variable types. CALLING CONVENTIONS Table Suggested 6-1 Variable Data Types Output Parameter VAX/VMS Hardware | Input Parameter Declaration Type Required Declaration Byte INTEGER, Word INTEGER Appropriate Longword INTEGER INTEGER Quadword Properly dimensioned array Properly dimensioned array CHAR CHAR packed record To store the output produced by a system service, you must allocate You can do so by declaring contain the output. to sufficient space Mailbox Create the example, For size. proper variables of the Thus, you can set (SYSSCREMBX) system service returns a 2-byte value. up storage TYPE space WORD = as follows: 0,.465535% CHAN.TYFE = FACKED RECORD BOT.CHAN : WORD END§ + . VAR CHAN..REC CHAN.TYFE?S + VALUE CHAN.REC t= (0)y FUNCTION SYS$CREMEX (ZIMMED FRMFLG ¢ INTEGER?® VAR CHAN : CHAN.TYFE; ZIMMED MAXMSGs BUFQUOy FROMSKy ACMODE § INTEGERS$ ZSTDESCR LOGNAM ¢ FACKED ARRAY [SUB&31 OF CHAR): INTEGERS EXTERNS + * MEX.REC . MEX..INT t= SYS$CREMBX (OsyCHAN.RECs Os Or Oy Oy ‘MAILBOX)¥ CALLING CONVENTIONS If the output is a quadword value, you must declare an array or record For example, the Get Time (SYSSGETTIM) system size. proper the of Thus, you would service returns the time as a quadword binary value. need to specify the following: TYFE QUAD = ARRAY VAR ISTAT OF INTEGERS$ QUADs ¢ SYSTIM [1..21 ¢ INTEGER? * FUNCTION SYS$GETTIM (VAR F_SYSTIM { QUADD! INTEGER? EXTERN: * ISTAT (= SYS$GETTIM (S8YSTIM)}$ to you allow not Optional Parameters - VAX-11 PASCAL does 6.2.3.2 If you choose not from procedure or function calls. parameters omit to supply an optional parameter, you should pass the value zero using For example, the Translate (%$IMMED) mechanism. wvalue immediate the optional three has service system (SYSSTRNLOG) Name Logical do not specify values for these parameters, you you If parameters. must include ISTAT zeros in their places, := SYSSTRNLOG ('CYGNUS', as follows: NAMLEN,NAMDES, 0,0,0); system services Passing Character Parameters - Some VAX/VMS 6.2.3.3 For example, require character parameters for either input or output. a accepts service system (SYSSTRNLOG) Name the Translate Logical name as input and returns the associated logical name or file logical specification, if any, as output. VAX/VMS system services usually require strings to be passed by string Specify $STDESCR in the function or procedure declaration descriptor. On descriptor. string by parameters string to pass the required packed array of characters must be or <constant character a input, passed to the are required: string and of (2) the output system service by descriptor. (1) On output, an INTEGER variable, which is set to the actual string. For example: TYFPE POS_WORD = 0,.65535% SURG3 = 1..635 WORD_TYPE = FPACKED RECORD SHORTWD : FOS.WORD ENDvy STRING..RUF = FACKED ARRAY [1.,.128]1 OF CHAR? VAR two parameters packed array of characters to hold the output a ICODE : INTEGERS NAMLEN : WORD.TYFES NAMDES : STRING.EBUF 6-11 1length CALLING FROCEDURE CONVENTIONS ERROR?$ * FUNCTION SYS$TRNLOG (XZSTDESCR VAR CYGNUS RSLLEN ! ! PACKED ARRAY LSUR&63] OF INTEGER) ¢ CHARS WORD.TYFES$ ZSTDESCR RSLEBUF { STRING.RUF$ ZIMMED TABLEy ACMODE, DSEMSK ¢ INTEGERS BEGIN L4 + * ICODE = SYS$TRNLOG (“CYGNUS’» IF NOT ODD (ICODE) THEN ERRORS3 NAMLENsNAMDES»0y0s4)3 The logical name CYGNUS is translated to its associated name or file specification, and the output values (length and associated name or file specification) NAMLEN causes and the system table; only Section 6.4 6.3 the VAX-11 can call VAX-11 to disable system Run-Time and the Library last of tables complete the are system you parameter, process specified with 1logical service example. provides mathematical These Reference procedures procedures are SEED.VAL ¢! that described in vyou the Manual. can invoke a Run-Time Library procedure from a PASCAL defining it as an external function and including the function reference. For example: RANDL.RSLT 4, name searched. You VAR -- value PROCEDURES programs. Library locations The search group LIBRARY PASCAL Run-Time in its another RUN-TIME from stored respectively. presents CALLING The are NAMDES, program by appropriate INTEGERS ¢ REALS + + FUNCTION MTH$RANDOM (SEED ¢ INTEGER) ¢ REAL$? EXTERNj * * RAND_.RSLT = This example (MTH$RANDOM) . When defining note the In uses a the function uniform for a pseudorandom Run-Time Library number generator procedure, you should following: e The e The the MTH$RANDOM(SEED.VAL)? mechanism by which (by-immediate-value, types appropriate pseudorandom reference and the number result is each by-reference, for the generator, a real or parameter parameters the number, seed as is passed by-descriptor) and the parameter shown. result is passed by EXTERN? CALLING CONVENTIONS 6.4 COMPLETE SYSTEM SERVICE EXAMPLE This section presents a sample PASCAL procedure that declares and calls the Get Job/Process Information (SYSSGETJPI) system service. The procedure declares SYSSGETJPI as an INTEGER function, so that upon return, it can check for successful completion. SYSSGETJPI is used here to get the process identification and name of the current process. When used for this purpose, SYS$SGETJPI requires information in only the fourth of seven parameters. The first, second, third, fifth, sixth, and seventh parameters must be null. The fourth parameter contains the address of a list of descriptors that describe the specific information requested and point to buffers to receive the information. 1In this example, the list is constructed as a record. It contains fields corresponding to each required item as noted in the description of SYS$GETJPI in the VAX/VMS System Services Reference Manual. FROCEDURE GETJFINFO (VAR NAME! FRCNAM? VAR ID! (XThis rrocedure calls the SYS$SGETJIFI INTEGER)# sustem service to get the process ID and rrocess names which are used as formal rarameters. It uses these tures and variables? WORD —- 16 bits to contain buffer lensgth and recuest code I.0. FTR_FPID -~ Address of rrocess FTR.PIDLEN -~ Address of srocess I.Il. lensth FTR.FRCNAM ~- Address of rsrocess name string FTR.FPRCNAMLEN ~- Address of length of srocess name string JPIREL -~ Record containing item list sarameter ICODE -- Status returned by SYS$GETIFI function The following ture is declared in the main srodram? FRONAM = PACKED ARRAY [1..1%5%1 OF CHARX) CONST TYPE NULL = OF WORD = 0..655353 RECJ = RECORD FIDINFO ¢ PACKED RECORD FIDLENy JFIS.FID ! WORD ENDS PTR..FID ¢ FTROFIDLEN FRCONAMINFO TINTEGERS ¢ "INTEGERS ¢ PACKED RECORD FRONAMLENy JPIS._FRCNAM 3 WORD ENDS FTR.FRCNAM ¢ "FRUNAMS FTR.FRCNAMLEN ¢ "INTEGERS ENDLIST ! INTEGER END¢ VAR TICODE JRIREC : ¢ INTEGERS: RECJS FUNCTION SYS$GETJFPI (ZIMMED A»EBsC ¢ INTEGER? VAR ITMLST YIMMED XsYe?Z ¢ INTEGER)Y ¢ INTEGERS (KAYEByC andgd XsY¥s?Z asre rull rarametersi) : RECJS EXTERNS CALLING CONVENTIONS BEGIN (XSet ur record rarameterx) WITH JRPIREC IO REGIN FPIDINFO.FPIDLEN ¢= NEW (FTR.PID)S NEW (FTR.FIDLEN)S FTR..FIDTM 45 §¢= FIDINFO.JFIS_PID (XLength AX3193% 03 ¢ e P FTR.FIDLENTM (kZero 03 P seme 2= $= FRCNAMINFO. JFPI$ . FRCNAM 154 3 e 3= I I variablex) address (XHex (kGet ¢ (FPTR.FPRCNAMLEN) of JPI$_.FRUNAMX) address of nameX) PTR.FRCNAMLENTM 3= 03 (¥XZero name lendgth ENDLIST (XList must end and $= 0 returrn SYS$GETJFI status ICODE = IF ODD ICODRE BEGIN THEN (NULLs WRITELN (‘Error in STATUS NULLs NULLS GETJPI JFIRECY rrocess’)$ HALT END ELSE (XIf NAME InD END 3 END := (= JFIREC.FPTR.FPRCNAMTMS JPIREC.PTR.FIDTM variableXx) with NULLs OX) NULLY errory (Xrrint (Xand BEGIN lendgthX) variableX) (XIf in of stringX) address function NOT rname (XGet * o (XCall lendgthX) variableX) bufferXx) ‘% = ENDS of (¥Zero ID length {(XLength of name (kRlank-fill NEW bufferXx) AX31CH (FPTR.FRCNAM) § PTR-FRCNAMTM of of JPI$.FIDX) address of 1DX) (XGet FRCNAMINFO.FRONAMLEN NEW CkHes: (XGet NULL) # %) error messadeX) haltXx) successful k) (kassidn rname to NAME (Xand assidn id to ID raramX) raramX) CHAPTER 7 ERROR PROCESSING AND CONDITION HANDLERS During the execution of your VAX-11 PASCAL program, various conditions, including errors and exceptions, <can occur. These conditions can result from errors during I/0 operations, invalid input data, incorrect calls to library routines, errors in arithmetic, or system-detected errors. VAX-11 PASCAL provides two methods of error control and recovery: e Run-Time e VAX-11 Library default Condition condition error-processing procedures Handling Facility (including handlers) user-written . These error-processing methods are complementary and can be wused in the same program. Thus, you have two options in dealing with errors. You can allow the Run-Time Library to provide all condition handling for vyou. The Run-Time Library provides default error processing by generating error messages for all error or exception conditions that occur during the execution of a PASCAL program. Section 7.1 describes error processing by the Run-Time Library as it applies to VAX-11 PASCAL. Appendix A describes the error messages that can be generated for a PASCAL program. At the lowest level, the VAX-11 Condition Handling Facility provides all condition handling for the Run-Time Library. You can also use it directly to provide procedures (user-written condition handlers) for processing conditions that occur during your program's execution. The use of condition handlers, however, requires considerable programming experience and should not be undertaken by novice users. You should understand the condition handling descriptions in the VAX/VMS System Services Reference Manual, the VAX-11 Run-Time Library Reference Manual, and the VAX-11 Architecture Handbook before vyou attempt to write 7.1 a condition RUN-TIME handler. LIBRARY DEFAULT ERROR PROCESSING By default, the Run-Time Library prints a message and terminates PASCAL program execution when an error occurs. These default actions occur unless Run-time your program errors are $PAS-F-code, includes reported in the a condition handler. following format: text The code is an abbreviation of the error message text, which explains the error. VAX-11 PASCAL run-time errors and recovery procedures are described in Appendix A. Most Run-Time Library procedures provide their own error messages, as described in the VAX-11] Run-Time Library Reference Manual. ERROR PROCESSING AND CONDITION HANDLERS 7.2 OVERVIEW OF VAX-11 CONDITION HANDLING When the VAX/VMS system creates a user process, it establishes a system-defined condition handler which, 1in the absence of any user-written condition handler, processes errors that occur during execution of the wuser image. Thus, by default, a run-time error causes the system-defined condition handler to print one of the standard error messages and to terminate or continue execution of the image, depending on the severity code associated with the error. When a condition is signaled, the system searches for a condition handler to respond. The system conducts the search by calling handlers in preceding stack frames wuntil it activates a condition handler that does not resignal. The default handler calls the system's message output routine so that it can send the appropriate message to the user. Messages are sent to the SYSSOUTPUT file and to the SYSSERROR file, if both files are present. If the condition permits, program execution continues. Otherwise, the default handler forces program termination and the condition value becomes the program exit status. You can create and establish your own condition handlers according to the needs of your applications. For example, you can create and display messages that specifically describe conditions encountered during execution of an application program, instead of relying on the standard 7.2.1 system error messages. Condition Signals A condition signal <consists of a call to one of the system-supplied signal procedures, LIBSSIGNAL and LIBSSTOP. signal procedures must be declared external, for example: PROCEDURE LIBSSIGNAL PROCEDURE LIBS$SSTOP (%IMMED (%IMMED CONDITION CONDITION You signal a condition when you do not : : INTEGER); INTEGER); want to two The EXTERN; EXTERN; handle it in the routine in which it was detected, but want instead to pass notification to other active routines. 1If the current procedure can continue after the signal is made, call LIB$SIGNAL. A higher-level procedure can then determine whether program execution is to continue. If the condition will not allow the current procedure to continue, call LIBSSTOP. Condition values are usually expressed as condition symbols. For example: LIBSSIGNAL You <can (MTHS_FLOOVEMAT); include information about additional the parameters to When called, a signal procedure searches for examining the preceding stack frames until handler that does not provide supplementary error. resignal. condition handlers by it activates a condition ERROR 7.2.2 Handler PROCESSING AND CONDITION Responses A condition handler responds action in three major areas: @ Condition correction e Condition reporting ® Condition control First, If it the handler <can, the continues. 1If the handler process to exception cannot condition. the <correct the That it is, a count by ® Resignaling the same condition to your terminal or log file ®¢ Changing the resignaling of can exceptions severity the taking the that handler another may condition encountered to field involve send of the the one or more during program appropriate condition of message wvalue and condition ©Signaling a different message oriented to a be <condition, requests handlers Maintaining execution can by exception. @ Execution <condition . Condition reporting performed the following actions: affected in condition, for example, specific application a number of ways. Among was them ©produce a are: Continuing from the a call to LIBSSTOP, e Unwinding to the establisher at the point of the call that resulted 1in the exception. The handler can determine the function value returned by the called procedure. e Unwinding to the establisher's <caller (the procedure called the procedure that established the handler). handler can determine the function wvalue returned by WRITING signal. 1If the signal the program will exit. to @ called 7.3 an determines whether it can correct the <condition. handler takes the appropriate action, and execution it resignal e HANDLERS issued through that The the procedure. A CONDITION HANDLER The following sections describe how to code and establish a condition handler, and provide some simple examples. See Appendix C of the VAX-11 Architecture Handbook, the VAX-11l Run-Time Library Reference Manual, details and the VAX/VMS §System on condition handlers. Services Reference Manual for more ERROR PROCESSING AND CONDITION HANDLERS 7.3.1 Establishing and Removing Handlers When a procedure is called, no condition handler is initially established. To use a condition handler, you must first define both the Run-Time Library procedure LIBSESTABLISH and the condition handler as follows: FUNCTION ERR_HANDLER : PROCEDURE LIBSESTABLISH INTEGER; EXTERN; ($IMMED FUNCTION HANDLER : ; INTEGER) EXTERN; To establish the handler, you must call LIBSESTABLISH. To remove an established handler, define the Run-Time Library procedure LIBSREVERT, and call it as PROCEDURE follows: LIBSREVERT; EXTERN; - LIBSREVERT; As a result of this call, current procedure the condition activation 1is handler removed. the condition handler established by the established When a procedure procedure 1is 1in the returns, automatically removed. Note that condition handlers written in PASCAL can access only own local data and data declared at program or module level. 7.3.2 Parameters their for Condition Handlers A PASCAL condition handler is an INTEGER function that is called when an exception condition occurs. You must define two formal VAR parameters 1. for a An integer array to refer to the parameter list from the call That is, procedure (the signal parameters). signal the to or LIBSSIGNAL to calls the list of parameters included in LIBSSTOP 2. example, TYPE (see Section 7.2.1). An integer array to refer to information concerning the procedure activation that established the condition handler (the For condition handler: mechanism arrays). you can define a condition handler as MECHARR = ARRAYLO..41 SIGARR = ARRAY [0..91 OF OF follows: INTEGER? INTEGER? + * FUNCTION ERR.HANDLER (VAR SIGARGS ! SIGARR? VAR MECHARGS : MECHARR) § INTEGER? REGIN * ENDy ERROR PROCESSING AND CONDITION FROCEDURE LIB$ESTABLISH LIBSESTARLISH (ZIMMED HANDLERS FUNCTION HANDLER ¢ INTEGER)$# EXTERNS (ERR_HANDLER) § * * + END . The array SIGARGS receives the values listed below from the signal being passed procedure. Value Meaning SIGARGS[0] Indicates how many parameters are in this array (parameter count). SIGARGS[1] Indicates the (condition discussion SIGARGS[2 to n] condition being value). See Section of condition values. signaled 7.3.4 for a Indicates the call optional parameters as specified by to LIBSSIGNAL or LIBSSTOP; note that the dimension bounds for the SIGARGS array should specify as many entries as necessary to refer to the optional parameters. The array MECHARGS receives information about the procedure activation status of the procedure that established the condition handler. The values from this procedure are listed below. Value Meaning MECHARGS[0] Specifies the number of parameters in this array (4). MECHARGS[1] Contains the address of the procedure activation stack frame that established the handler. MECHARGS[ 2] Contains the number of (that 1is, the stack procedure activation, the MECHARGS [ 3] Contains the MECHARGS[4] 7.3.3 Handler exception listed up to the point been made from the at which occurred. value of register RO at the time of value of register Rl at the time of signal. Contains the the signal. Function Return Values Condition handlers specify subsequent execution. The are the calls that have frame depth) below. function function return values return values and to their control effects ERROR PROCESSING AND CONDITION HANDLERS Value Effect SSS_CONTINUE Continues execution from the signal. signal was issued by a call to however, the program exits. If the LIBSSTOP, Resignals to continue the search for a condition SSS$_RESIGNAL handler to process the condition. In addition, a condition handler can request a stack unwind by calling SYSSUNWIND before returning. FUNCTION SYSSUNWIND INTEGER; ‘ Declare SYSSUNWIND as follows: : (%$IMMED DEPTH INTEGER; $%IMMED NEWPC : INTEGER): EXTERN; When SYS$UNWIND is called, the function return value is ignored. The Rl in the mechanism and RO registers saved the modifies handler parameters to specify the called procedure's function value. A stack e unwind can be made resulted in the := at the Specify: exception. SYSSUNWIND two places: point of call the := that (MECHARGS[2],0); Unwind to the procedure that called the establisher. STATUS 7.3.4 one of Unwind to the establisher, STATUS @ to SYSSUNWIND Specify: (0,0); Condition Values and Symbols has procedure VAX-11 uses condition values to indicate that a called report exception to and failed, successfully or executed either (usually records packed 32-bit are values Condition conditions. interpreted 'as integers), consisting of fields that indicate which was value the reason the value, the generated system component A condition value has the severity of the condition. and generated, the form: 31 28 27 c Field Bits C 31:28 Facility 27:16 Message 15:3 16 15 32 FACILITY MESSAGE 0 SEV Meaning Control bits Identifies the software component wvalue. condition the generated facility. indicates a customer indicates a DIGITAL facility. that 27 =1 Bit 0 = 27 Bit Describes the condition that occurred. Bit 15 1is specific to a message the indicates 1 = a indicates 0 = 15 Bit facility. single system-wide message. ERROR Sev 2:0 CONDITION HANDLERS Meaning Specifies a severity - warning - success - error 5, 6, code, | Bits AND NWNOHO Field PROCESSING information ~ severe - reserved as follows: error A warning severity code (0) indicates that output was produced, but that the results might not be what you expected. An error severity code (2) indicates that output was produced even though an error was detected. Execution can continue, but the results will not all be correct. A severe error code (4) indicates that the error was of such severity that output was not produced. A condition handler can alter the or The severity code of force an exit, a condition value to allow execution depending on the circumstances. to condition SIGARGS. value is passed Occasionally, as your the second <condition element handler may to of continue the require particular condition be identified by an exact match. That bit of the condition value (31:0) must match the specified array that a 1is, each condition. For example, you may want to process a floating overflow condition only 1if its severity code 1is still 4 (that 1is, if no previous condition handler has changed the severity code). As noted above, a typical <condition handler response is to change the severity code and resignal. In many cases, however, you regardless of the value of and control fields of a LIBSMATCH_COND function, as FUNCTION may want to respond to a condition, the severity code. To ignore the severity condition wvalue, declare and call the follows: LIBSMATCH_COND (CONDVAL,COMPVAL : INTEGER): BOOLEAN; EXTERN; * IF LIBSMATCH_COND(SIGARGS[1],PASS_ERRACCFIL) THEN... 7.3.5 Floating-Point Operation Some conditions involving floating-point operations require special action 1if you want to continue execution. Operations that involve, for example, floating overflow, dividing by 0, or computing the square root of a negative number store a unique result known as a floating reserved operand. If a subsequent floating-point this result, a hardware reserved operand signaled. This can continue indefinitely if does not change the reserved operand, because each time the computation is retried. operation accesses fault 1is generated and the condition handler the operand is accessed ERROR PROCESSING AND CONDITION HANDLERS To allow computation to continue, you must change the reserved operand by defining and calling the Run-Time Library routine LIBSFIXUP_FLT, as follows: FUNCTION LIBSFIXUP FLT (VAR VAR MECHADR MECHVECTOR; INTEGER; STATUS:= : SIGADR : SIGVECTOR; VAR OP : DOUBLE) : EXTERN; LIBSFIXUP_FLT(SIGARGS,MECHARGS,NEWOPERAND); The types SIGVECTOR and MECHVECTOR in this example refer to the types of the signal and mechanism argument vectors, which are assumed to be defined in the calling procedure. Note that you should specify the third parameter as a double-precision variable. This ensures that the reserved operand will be changed correctly regardless of its precision. If you do not have a special value for this parameter, specify 0.0. For more information on LIBSFIXUP_FLT, see the VAX-11 Run-Time 7.4 The Library Reference Manual. CONDITION example in HANDLER this EXAMPLES section illustrates how to declare and wuse a condition handler with a typical PASCAL procedure. It establishes a condition handler that is called when an error occurs in a file opening procedure. opening/creating the unwind is performed. If the error is the general "Error file," signified by the PASS_ERROPECRE code, an Any other error is resignaled. PROCEDURE OPENHAND} (XThis erocedure shows how to establish and call a condition 3 PASCAL rrodsram. It uses these tures!? DATAREC ~- a2 record ture for the accounting file handler from DATAFILE -—SIGARR —-- MECHARR -Arnd % a an file ture with comrorents arraw ture an array for signal ture for mechasnism it declares these dglobal variables? FLAG ~—- a Boolean set to TRUE when NEW_ACCOUNTS -- STATUS all-rurrose CONST an ZINCLUDE (XThis TYFE -- a file = FLAG ! DATAREC rarameters an error occurs DATAFILE tuyre return status variable the PASCAL declarations of the condition RECORD PACKED ARRAY ¢ REALS COST REAL3 PACKED ¢ { ARRAY [1..301 OF CHARj} [1..113 OF CHAR = FILE OF DATARECS ARRAY [0..9]1 OF INTEGERS$ MECHARR = ARRAY VAR function NAME : AMOUNT ESTE Ds DATAFILE SIGARR = of twure ‘SYS$LIBRARY!SIGDEF.PAS’ file contains DATAREC varisble of rarameters [0..41 OF BOOLEANS? NEW.ACCOUNTS ¢ DATAFILES STATUS ¢ INTEGERS INTEGERS slsnals*) ERROR PROCESSING AND CONDITION HANDLERS PROCEDURE LIBSESTABLISH (ZIMMED FUNCTION FIXER ¢ INTEGER)S EXTERNS (XThe sustem service rrocedure LIBSESTABLISH will be called to establish the condition handlerx) PROCEDURE OPENER (VAR ACCOUNTS ¢ DATAFILE); (XThis erocedure will be called to oren the file records the in it. It slso OPEN processing (XLocal is rerforms shown dats here for entry and and write cleanuer. new Only simplicituk) variable declarationsx) FUNCTION HANDLER (VAR SIGARGS ¢ SIGARR? VAR MECHARGS { MECHARR) ! INTEGERS$ (XThis function will be called to handle 2 file orening error during the OPENER rrocedure. It uses only dloballuw declared variablesg» excert for the SYSSUNWIND and LIBSMATCH.COND functions.X) FUNCTION SYSSUNWIND INTEGERS FUNCTION (DEPTH LIBSMATCH.COND ROOLEAN? ¢ INTEGER$ ZIMMED NEWPC ¢ INTEGER)!} EXTERNS$ (CONDVAL» COMFVAL ¢ INTEGER)$ EXTERN$ BEGIN IF END$ (LIBSMATCH._.COND (SIGARGSL11y PAS$_ERROPECRE)) THEN (XIf error orening filesX) BEGIN FLAG := TRUE? (kset file error flad€x) STATUS $= SYSSUNWIND(MECHARGSL21+1s 0) (kand unwindX) END$ HANDLER (= SS$_RESIGNAL (XIf some other errorsy resignalXx) (Xend HANDLERX) BEGIN LIBSESTABLISH (HANDLER)$} (Xestablish condition handlerx) OPEN (ACCOUNTS» ‘LDATAJACCOUNTS.DAT’»0LDs SEQUENTIAL)? (XData entryr END} BEGIN (XThis is the FLAG storadger and cleanurX) (XEnd OPENERX) start of the outermost (=FALSE} OPENER (kinitialize (NEW._ACCOUNTS) 3 IF FLAG THEN WRITELN srocedurex) (‘Error (¥oren Flag to FALSE for test belowk) fileX) in orening file’) (XFrint END# the (XEnd OPENHANDX) 7-9 messade if error handler was calledX) CHAPTER VAX-11 This chapter system and describes the PASCAL the VAX-11 8 SYSTEM ENVIRONMENT relationship PASCAL between compiler. the It VAX/VMS covers operating the following topics: e Use @ Storage of scalar ® Storage of unpacked ® Storage of packed ® Representation 8.1 USE OF The VAX-11 program of program sections and pointer structured structured of types types types floating-point data PROGRAM SECTIONS PASCAL sections, compiler to store uses contiguous information Linker controls memory allocation and attributes of each program section. program section areas about of the memory, program. sharing Table 8-1 called The according lists the VAX-11 to the possible attributes. Table Program 8-1 Section Attributes Attribute Meaning PIC/NOPIC Position independent CON/OVR Concatenated REL/ABS Relocatable GBL/LCL Global SHR/NOSHR Shareable EXE/NOEXE Executable RD/NORD Readable WRT/NOWRT Writeable or or or overlaid or absolute local scope or nonshareable or or or position nonexecutable nonreadable nonwriteable dependent VAX-11 PASCAL SYSTEM ENVIRONMENT VAX-11 PASCAL implicitly declares three program sections: S$SGLBL, SCODE, and S$PDATA. Table 8-2 summarizes the usage and attributes of these program sections. Table 8-2 Program Section Usage and Attributes Program Section Name Usage SGLBL Read/write static data declared at module or program Attributes PIC, OVR, REL, GBL, NOSHR, NOEXE, RD, WRT level SCODE Read-only generated executable code PIC, SHR, CON, EXE, SPDATA Read-only that need pPI1IC, SHR, CON, REL, LCL, NOEXE, RD, NOWRT constants storage REL, LCL, RD, NOWRT Each module in your PASCAL program is named according to the identifier specified in the program or module header. You can use the module name to qualify the program section name in LINK commands. For more information, refer to the VAX-1ll Linker Reference Manual. When the 1linker constructs an executable image into sections. sections executable image, it divides the Each image section contains program that have the same attributes. allocation by arranging The 1linker controls memory image sections according to program section attributes. The linker allows you to use special options to change program section attributes and to influence the memory allocation in the image. You include these options in an options file, which is input to the linker. The options and the file are described in the VAX-1ll Linker Reference 8.2 Manual. STORAGE OF SCALAR AND POINTER TYPES When not part of a packed structure, allocated storage space as summarized the scalar types in Table 8-3. in PASCAL are Variables of scalar types, with the exception of DOUBLE variables, are aligned on a boundary corresponding to their sizes. DOUBLE variables are aligned on longword boundaries rather than on quadword boundaries. Variables of subrange types are allocated and aligned in the same way as variables of the associated scalar types. For example, an integer subrange variable is allocated one 1longword and 1is aligned on a an enumerated type DAYS_OF_ WEEK of subrange A boundary. longword (with values SUNDAY, MONDAY, TUESDAY, and so on) is stored in one byte and aligned A pointer is on a byte boundary. simply a longword containing an address. VAX-11 PASCAL SYSTEM Table Storage of Scalar ENVIRONMENT 8-3 and Pointer Types Type Storage Allocation Alignment Character 8 bits (1 byte) Byte Boolean 8 bits (1 byte) Byte Integer, single, real | 32 bits (1 longword) | Longword Double 64 bits (1 quadword) | Longword Enumerated 8 bits (1 byte) if type contains 256 elements or less; 16 bits (1 word) if type contains more than Pointer 8.3 32 STORAGE OF The unpacked and aligned only to data array For is bits Byte if type contains 256 elements or less; word if type contains more than 256 elements elements (1 longword) | Longword STRUCTURED TYPES structured types (sets, arrays, and records) are as described below. Note that this description items that are not part of another structure. A set consists boundary. An UNPACKED 256 Boundary of 32 stored example, bytes and each aligned element longword and aligned on of a character array boundary. a (8 1longwords) according of an to aligned the array of type on of a its integers is stored applies longword elements. stored in a longword boundary. Similarly, each element 1is stored 1in a byte and aligned on a byte Records The the on are stored field by field according to the type of each field. type of the first field in the record establishes the alignment of entire record. Subsequent fields in the record are always aligned byte boundaries, regardless of the type of the first field. For example: VAR A ¢ RECORD X : INTEGER ; Y ¢ BOOLEAN ; Z : INTEGER END; Record A is aligned on a longword contains an integer value, which shows how this record is stored. Bytes 0 which through is contains through an 3 (bits integer 0 through 1longword the Boolean value of 71) contain the other Y, boundary is 31) stored in contain value. and integer because Byte a its first longword. the 4 first (bits bytes 5 through longword value, Z. field, Figure 32 8 X, 8-1 field, X, through 39) (bits 40 VAX-11 PASCAL SYSTEM ENVIRONMENT 7 //////////////////;/;///////////////71 z((?NO::ss:) ] Figure 8.4 STORAGE OF PACKED Although you can for sets, storage. only their In general, the "32-bit 8-1 Storage of Sample STRUCTURED TYPES pack any arrays, structured type, packing saves storage space and records. Packing files has no effect on storage space for packed rule," as follows: e Any data item that is 32 as few bits as possible. e Any data possible item over number of types bits or descriptions apply is less allocated in length according is packed to into 32 bits 1long 1is allocated the smallest bytes and is aligned on a byte boundary. The subsections below describe exactly how each packed type and note any exceptions The Record only to data items storage 1is allocated to to the general 32-bit rule. that are not part of another structure. 8.4.1 Storage of Packed Sets A packed set that is not a component of another packed structure byte-aligned. Each packed set 1is allocated space according to 32-bit rule, based on the ordinal value of its largest element: e If the ordinal value is less than or equal to 31, the set is allocated the number of bits equal to the ordinal value plus one. For example, a packed set of 2..19 is allocated 20 bits. e If the ordinal value is greater than 31, the set is allocated the number of bits equal to the ordinal value plus one, rounded up to the nearest byte boundary. For example, a packed set of subrange type 100..101 is allocated 13 bytes (101+1 bits rounded up to a byte boundary). Since the size of a values from 0 to longwords) 8.4.2 of array aligned on the nearest packed set is 255, a 1limited packed to set 256 elements, with can occupy at most 32 ordinal bytes (8 memory. Storage of A packed of 1is the Packed Arrays that is not a component of another a byte boundary. The elements bit. Table 8-4 lists the space arrays. packed of the array requirements structure are for is packed to elements VAX-11 PASCAL SYSTEM ENVIRONMENT Table 8-4 Storage of Packed Array Elements Storage Type Allocation Boolean 1l bit Character 8 bits (1 byte) 32 bits (1 longword) Double 64 bits (1 quadword) Subrange of integer, character, or Minimum number of bits in which the largest and smallest possible values Enumerated types Number of bits required for ordinal value Pointers 32 bits (1 longword) All structured types Same Integer, real, single can be expressed enumerated type as structured types 1largest not in However, if the total packed array. is type structured the of size array the bits, 32 than greater minimum a allocated 1is element number of bytes, that is, the 32-bit types Structured applies. rule 32 bits or less space are requiring bit-aligned. into the minimum amount of Note that integer subranges are packed to hold the largest or smallest value, whichever needs space needed OF [1..10] For example, each element of PACKED ARRAY more space. [1l..64] ARRAY PACKED of element Each bits. 8 allocated is -128..127 OF 0..7 is allocated 3 bits. Enumerated types are packed into the number of bits required to hold For example, an enumerated type with 16 largest ordinal value. the through 0 values is allocated 4 bits, because its ordinal values are 15. A packed array of an unpacked structured type saves no storage space. of such a specification is to byte-align the array. effect only The The type. structured packed a Instead, specify a packed array of following two examples illustrate this difference. Examples 1. TYPE INT_SET = SET OF 0..14; PACKED ARRAY [1..5] VAR INT_ARR : OF INT SET; 1longwords. 8 as is stored INT SET type An unpacked set of Consequently, each element of INT_ ARR requires 8 longwords, for a total of 40 longwords (640 bits) of space. VAX-11 2. TYPE VAR A INT_SET INT_ARR packed set of INT_ARR the entire Storage for allocated = : PASCAL PACKED SET PACKED ARRAY of type SYSTEM OF 0..14; [1..5] INT_SET therefore ENVIRONMENT is requires OF INT SET; allocated 15 bits, 15 bits. a total for Each of 75 element bits for records is array. packed arrays of records and arrays of packed similarly. Multidimensional arrays can also be packed. As for the other structured types, you must specify packing at the innermost level to gain any significant space advantage. For a 2-dimensional array, an array of of array, an a packed as array in the generally following takes less space than a packed array examples. Examples 1. TYPE INTERNAL ARR = VAR SAMP1_ARR : Each element of longword. longwords INTERNAL Each ~- ARRAY PACKED an array element enough ARR. The longwords (800 bits). 2. VAR SAMP1 ARR : VAR SAMP1 : ARR [1..5] ARRAY of type of entire PACKED OF INTERNAL ARR; INTERNAL space array ARRAY [1..5] 0..6; ARR is SAMP1 ARR, in storage ARRAY OF [1..5] for 5 SAMPl1 ARR [1..5,1..5] OF PACKED turn, stored elements therefore OF ARRAY in requires of a 5 type occupies 25 0..6; [1..5] OF 0..6; Specifying PACKED for an array with multiple subscripts results in packing only at the innermost level. Therefore, the two array declarations in this example are equivalent. Each PACKED ARRAY[1..5] OF 0..6 are elements of even 16 bits. bits. Example allocating this 3. TYPE VAR INTERNAL ARR = SAMP2_ARR requires 15 bits. Because the packed arrays an unpacked array, their size is rounded up to The total size of each SAMP1_ARR is therefore 3 shows a slightly more efficient way array. : PACKED PACKED ARRAY ARRAY [l1..5] [l..5] OF OF an 80 of 0..6; INTERNAL_ ARR; In this example, each element of INTERNAL ARR requires only 3 bits because the array is packed. Each element of SAMP2 ARR can be stored in 15 bits, and the entire array occupies 75 bits. 4. TYPE INTERNAL ARR SAMP3_ARR VAR This SAMPLE : example = = PACKED PACKED PACKED shows ARRAY how ARRAY ARRAY you [1..5] can [1..5] [1l..5] OF OF OF 0..6; INTERNAL ARR; SAMP3 ARR; maximize space savings for arrays of more than two dimensions by specifying PACKED at every level. As in Example 3, each element of INTERNAL ARR requires 3 bits, and each element of SAMP3 ARR requires 15 bits. The entire array SAMPLE, then, requires 375 bits. 8.4.3 Storage of A packed aligned record on a allocated space Packed that byte Records is not a component of another packed structure is boundary. The fields within the record are depending on their sizes and types. VAX-11 Fields of scalar packed to the aligned on unpacked Except set, a types, nearest byte PASCAL if less bit. boundary SYSTEM ENVIRONMENT than or A field and is equal that to 32 requires allocated space bits more as 1long, than for a 32 are bits field of is an record. for its alignment, or record unpacked record. the of type VAR the a occupies To pack field to SAMPLEl : such be PACKED field the that same a contains amount field, packed. you For an of wunpacked space must in a array. packed explicitly or declare example: RECORD A : =128 B : BOOLEAN; ..127; C : ARRAY [1..5] OF 0..30 END; This record is Field byte-aligned Storage 1 C storage as follows: bit 160 A, an integer bits subrange, amount of space, 7 data takes up one bit, leaving 7 which longword) Figure allocated 8 bits B array, is Allocation A Field and for 8-2 1is allocated each shows 1is bits bits of how 5 stored 1in the smallest plus a sign bit. unused. Field storage as for Field C is integers, B, a an possible Boolean, unpacked 32 bits (1 specifies a elements. this record is 31 stored. 15 8 ci1l] unused Cl2] cl1] Ci3] Cl2] Cl4] CI[3] Cisl 7 I B I 0 A Cl4] C[5] 175 Figure This record requires Compare the packed array. VAR a preceding SAMPLE2 : 8-2 total Storage of example PACKED 176 with of Sample bits (11 the next Record words) one, of : -128..127; B : BOOLEAN; C : PACKED ARRAY [1..5] OF storage. which RECORD A END; 167 0..30 VAX-11 This record PASCAL is byte-aligned Field Storage A and SYSTEM is ENVIRONMENT allocated storage as follows: Allocation 8 bits 25 bits 1 bit B C Fields A and B are allocated the same amount of space in both sample records. Field C, however, requires much less space in SAMPLE2 because it is packed. Each element of the packed array C occupies only 5 bits. Figure 8-3 shows how this record is stored. 31 29 24 C[5] ci4] 19 14 CI3] 987 cl2] Cl1] 0 B A C[5] 33 Figure 8-3 Storage of This record requires a 8.5 REPRESENTATION OF Sample total Packed of 34 Record bits FLOATING-POINT of 32 Containing Packed Array storage. DATA The following sections summarize the 1internal representation of single-precision (REAL and SINGLE types) and double-precision (DOUBLE type) floating-point numbers. For more detailed information, see the VAX-11 Architecture 8.5.1 Single-Precision Floating-Point A Handbook. single-precision contigueus as shown in bytes. Figure floating-point The 8-4. bits are 15 14 S Data value numbered (SINGLE, 1is EXPONENT represented from the 76 REAL Types) right 0 by four through 31, 0 FRACTION A FRACTION 31 Figure A 8-4 16 Single-Precision Floating-Point Data Representation single-precision floating-point value is specified by its address A, the address of the byte containing bit 0. The form of the value is sign magnitude with bit 15 the sign bit, bits 14 through 7 an excess 128 binary exponent, and bits 6 through 0 and 31 through 16 a normalized 24-bit fraction with the redundant most significant VAX-11 fraction bit not significance go PASCAL represented. from 16 SYSTEM Within through 31 ENVIRONMENT the and 0 The 8-bit exponent field encodes the exponent wvalue of 0, with a sign floating-point value has a value of 0. 255 indicate binary exponents of 0, with a sign bit of Floating-point instructions reserved The operand value of a floating point through single-precision value 8.5.2 A -127 is bits of increasing 6. wvalues bit of Exponent 0 through 255. An 0, indicates that the values of 1 through through +127. taken as a processing An exponent value reserved operand. reserved operand take a a fault. .29% (10**-38) decimal of 1 fraction, through number is in the 1.7*%(10*%*38). is approximate The approximately one range of of a precision part in 2**23, or 7 digits. Double~Precision Floating-Point double-precision floating-point contiguous bytes. The as Figure 8-5. shown in bits are wvalue numbered 1514 S Data (DOUBLE 1is from represented the 76 EXPONENT Type) right 0 by eight through 63, 0 FRACTION A FRACTION FRACTION FRACTION 63 Figure A 8-5 48 Double-~Precision double-precision the address of double-precision Floating-Point floating-point value is the byte containing floating-point value Data specified bit is single-precision floating-point value except low-significance fraction bits. Within the increasing significance are numbered 48 through through The 31, exponent and 0 through conventions # Representation by its address A, 0. The form of identical to a a for an additional fraction, bits 63, 32 through 47, 32 of 16 6. and approximate range of values are the same for double-precision floating-point wvalues as for single-precision floating-point wvalues. The precision of a double-precision floating-point value is approximately one part in 2*¥*55, or 16 decimal digits. A APPENDIX DIAGNOSTIC MESSAGES This appendix summarizes the error messages that can be generated by a PASCAL program at compile time and at A.1 run time. COMPILER DIAGNOSTICS listing source VAX-11 PASCAL reports compile-time diagnostics in the (in terminal the them on summarizes and created) is one (if interactive mode) or in the batch 1log file (in batch mode) . Compile-time diagnostics are preceded by the following: $PAS-1-DIAGN The 1 represents the severity level indicates a warning-level of the error which will error. A level not prevent your of W program from linking or executing. A level of F indicates a fatal error which you must correct for your program to link and execute properly. The diagnostic messages that the PASCAL compiler can print are below. All messages are printed with both number and text. with numbers less than 400 must correct for ©proper you that errors syntax indicate serious compilation. Messages with numbers greater than 400 indicate the use of compiler 1 listed Messages VAX-11 PASCAL extensions and illegal options. Error in simple type The declaration for a base type of a set or the index type of array 2 contains a syntax an error. Identifier expected The statement syntax requires an identifier, but can be PROGRAM or none found. 3 PROGRAM or MODULE expected The statement syntax requires the reserved word MODULE. 4 ')' expected The statement syntax requires the right-parenthesis character. ':' expected The statement Illegal The in OF colon, The statement '(' expected Error in 12 13 contains an illegal symbol, illegal character. 15 '[' expected The statement ']' expected The statement END expected ';' expected The statement Integer The such as a misspelled list list contains a syntax error, or semicolon character. such as syntax requires the reserved syntax requires the left-parenthesis syntax requires a syntax requires the left syntax requires the right The compiler cannot find of a compound statement, 14 character. a missing word OF. character. type The statement is present. 11 colon a expected The statement 10 requires or parameter parameter comma, MESSAGES symbol The statement reserved word Error syntax DIAGNOSTIC syntax the data type, delimiter subprogram, or but square type bracket square END, no identifier character. bracket which marks character. the end program. requires the semicolon requires an integer, character. expected statement statement syntax label. for example, as a DIAGNOSTIC 16 '=' MESSAGES expected The statement syntax requires the equal constant identifier from a constant value identifier from a type definition. 17 BEGIN beginning of an find the executable delimiter BEGIN, 20 21 marks the expected '..' Error in The field ',' expected The statement list in a syntax record declaration contains requires Empty parameter (successive The 1list parameter Illegal which is required field-list (nonprintable) The program contains a comma ',') attempts parameter, or contains omit optional parameters. 22 which section. The compiler cannot £find the .. symbol, between the endpoints of the subrange. 19 to separate a separate a type expected The compiler cannot 18 sign or to an ASCII a syntax error. character. not allowed to specify a null extra comma. In PASCAL, or missing you cannot printable ASCII character a character that is not a character. 50 Error in constant A constant 51 52 contains ':=' expected The statement THEN expected syntax The compiler cannot IF-THEN 53 UNTIL illegal requires character the or assignment is‘improperly formed. operator. find the reserved word THEN to complete the find the reserved word UNTIL to complete the statement. expected The compiler cannot REPEAT an statement, DIAGNOSTIC 54 DO expected The 55 58 59 compiler cannot statement or TO/DOWNTO expected the The compiler FOR statement. Invalid the reserved word DO to complete the FOR word TO or DOWNTO in the statement. find the reserved expression statement the compiler Error find WHILE cannot The A MESSAGES in syntax finds requires is not an expression, legal in an element or record but the first symbol expression. variable reference to an array field contains a syntax error. 60 ARRAY The expected compiler cannot find the reserved word ARRAY in the type definition. 97 Strings in excess of 65535 Relational operators 65535 bytes. 98 99 Parameter count The number 255, of end program 100 Array A 101 cannot exceeds 255 parameters to End of input encountered aborted. The of the had size input been too array 1is bits for You declared identifier <can sections. in applied to strings a procedure or function was end of comparisons 1longer cannot program. encountered than exceed Compilation before an entire large declared An allowed be before file not parsed. 2,147,483,647 Identifier characters is 1larger a than 2,147,483,647 bytes or array. twice declared redeclare packed twice identifiers within a only in declaration different section. declaration DIAGNOSTIC 102 MESSAGES Lowbound exceeds highbound The lower limit of a subrange is greater than the upper limit of the subrange, based on their ordinal values in their base type. 103 Identifier is not of appropriate class The identifier names the wrong class of data. For example, it names a constant where the syntax of the statement requires a procedure. 104 Identifier not declared The 105 107 program uses Sign not minus nonnumeric type. sign has Incompatible subrange types The subrange that has not been declared. types are not occurred compatible before an expression according to the rules of of compatibility. File not allowed A file 109 identifier allowed A plus or type 108 an in variant part type cannot appear in the variant part of a record. Type must not be REAL or DOUBLE You cannot specify a real value here. Real values cannot be used as array subscripts, control values for FOR loops, tag fields of variant records, 110 elements of set expressions, subrange types. Tagfield type must be The tag field for scalar or a variant or boundaries of subrange record must be a scalar or subrange type. 111 Incompatible with tagfield The case label and the tag These two items must be compatibility 112 Index type field are compatible of incompatible types. according to the general rules. type must not be REAL or DOUBLE Array subscripts cannot be integer or integer subrange real values; values. if numeric, they must be DIAGNOSTIC 113 Index type must Array of 114 a subscripts structured Base The be type base must scalar must be or MESSAGES subrange scalar or subrange values, and cannot of the be type. not type of be REAL this set or or DOUBLE subrange cannot be one real types. 115 Base The type must base values, 116 Actual The be type of and this cannot parameter actual scalar or set subrange or subrange be of a structured must be a set parameter must be of of must be scalar or subrange type. correct correct size size when passed as a VAR parameter. 117 Undefined The 118 119 base VALUE forward type in pointer was a initialization must be type declaration: <name)> not TYPE defined initialization statement can block; vyou cannot initialize Forward declared; cannot Function repetition repeat declaration of a result the in the section. in main program A VALUE program You 120 of reference of appear only variables in parameter parameter list 1list not after in the main subprograms. allowed the type must be scalar, subrange, or pointer The function specifies a result that is not a scalar, or pointer type. Function results cannot be structured 121 File value A 122 file Forward parameter not cannot declared The result declaration can 123 appear Missing be of and only result The function the function. forward subprogram. passed allowed as function; the in the type in heading a value parameter. repetition function the later in subrange, types. forward of appears complete result type not allowed in both the forward declaration. The result declaration. function declaration does not declare the type of the result of DIAGNOSTIC MESSAGES 124 F-format for REAL and DOUBLE only You can specify two integers in the field width for 125 real, single, correct predeclared of not is function the Number of parameters does not agree with declaration different subprogram. parameters passed to is subprogram the from the number of formal parameters declared for that You cannot add or omit parameters. Parameter cannot be element of a packed structure pass you cannot You subprogram; use 128 a type. The number of actual 127 R:3:2) Error in type of predeclared function parameter A parameter passed to 126 as (such and double values only. a to structure packed a of element one pass the entire structure if you want to must it. Result type of actual function parameter does not agree with the type declaration The result of an actual function parameter is specified in the 129 not Operands are of incompatible types Two or more of the operands in an expression are of types. and a 130 of formal parameter list. For incompatible example, the program attempted to compare a numeric character variable. Expression is not of set type The operators you specified are valid only for set expressions. 131 Type of variable is not set The statement syntax requires a set variable. 132 Strict inclusion not allowed inclusion. to test set You must use the <= and >= operators allow you to use the less than (<) and greater not PASCAL does than 133 (>) signs. File comparison not allowed Relational operators cannot be applied to file variables. DIAGNOSTIC 134 Illegal You type cannot specified 135 136 138 perform This operation Set element must The elements operand have must of be a types The elements of square Index operation set that bracket is is or Type of not variable A period 141 Type of Illegal subrange be scalar structured or set not are not all appears of an comma array inside not must parameter Loop control scalar of the same type square is followed be a variable file The in specified this by a left compatible with the type that a or is not record type. pointer after the name of a variable that substitution variable must of type. declaration be an compatible unstructured, variable. type Sets brackets. control variable in a FOR loop must be subrange, or user-defined scalar type; Illegal types. record following variable the array compatible with is subrange The 144 of types. The type of an actual parameter is not of the corresponding formal parameter. 143 items operand. or A circumflex character appears is not a file or pointer. 142 data compatible not a Boolean must of not is a The specified array subscript is not specified in the array declaration. 140 on Boolean scalar this variable type be elements element of specified requires Set Type the types. of A variable 139 operand(s) Type cannot 137 of MESSAGES an with the type non-floating point integer, it cannot integer be a real expression expression position. evaluates to a type that is incompatible DIAGNOSTIC 145 Type conflict between control MESSAGES variable and loop bounds The type of the control variable in a FOR with the type of the bounds you specified. 146 Assignment of You to assign one file to give values to files. type of a case label is selecting expression expressions Subrange You can specify 149 Index must bounds be of must type must not Output procedures incompatible with the type evaluates. Case labels and compatible be must be be Assignment to this types. Assignment to You assign cannot value formal a types only. You cannot integer function a to which selecting scalar type of a nondynamic an integer subrange. You cannot assign identifier. 151 another. specify subranges of scalar a real or string subrange. The index it can be 150 incompatible Label types incompatible with sélecting expression The the 148 1is allowed cannot used 147 files not 1loop is to array not an cannot to integer, although predeclared function allowed external function parameter value be the or is name not of allowed a formal function parameter, 152 153 No such field in this You attempted field name. to access Error count The number option. 154 Type of exceeds of errors record a record error limit. exceeds parameter must be The actual parameter an integer. 30, by an incorrect or nonexistent Compilation aborted the limit set by the ERROR_LIMIT integer passed to this function or procedure must be DIAGNOSTIC 155 Recursive $INCLUDE not allowed. The $INCLUDE directive directive appears. 156 Multidefined case The 157 same case label can be Case label MESSAGES cannot Compilation aborted 1include a call specified to label used refers only to once range exceeds which Double, to NEW than more within real Previous or 162 Each case smallest case one statement. CASE statement. 1000 the largest and cannot be tagfields real declaration was of is a procedure Type The type record allowed string variables, but must be forward already procedure or or not procedure already never were the or function that was not block was illegal. The Undeclared or not has subprogram has constants refers. Procedure/function A 163 the than DISPOSE, more tagfield number of nested variants in string The reiteration forward-declared 161 which the or the the pointer Tag fields scalar. 160 in Missing corresponding variant declaration In 159 file label The range of ordinal values between labels must not exceed 1000. 158 the been been forward function: function was forward declared declared. <name> forward-declared but its declared. of parameter subprogram must be requires real a or integer real or integer expression as a parameter. 14 164 This The procedure/function cannot specified actual predeclared parameter. If you be an actual procedure must directly. A-10 use or it parameter function in the cannot subprogram, be an call it DIAGNOSTIC MESSAGES 165 Multidefined label a A label appears in front of more than one statement in executable 166 single section. Multideclared label The program declares the same label more than once. 167 Undeclared label The program contains a label that has not been declared. 168 Undefined label: <label> The program defines a label, but does not use the executable 169 label in the between 0 and section. Set element value must not exceed 255 The ordinal value of an element of a set must be 255. 170 Value parameter expected A subprogram that is passed as an actual parameter can have value 171 Type of variable must be textfile file The program heading specifies an external file that has not been variable as an subprogram operation or operand parameter. or requires a Undeclared external file declared at program or module 173 (FILE OF CHAR) text The specified 172 only parameters. level. Negative set elements not allowed The value of an integer set element must be between 0 and 255. 174 Type of parameter must be file The specified subprogram requires a file as a parameter. 175 INPUT not declared as an external file file variable The program makes an implicit reference to the redeclared been has or declared, not either is but INPUT INPUT, at an inner level. A-11 DIAGNOSTIC 176 MESSAGES OUTPUT not declared as an external file The program makes an implicit reference to the file wvariable OUTPUT, but OUTPUT is either not declared or has been redeclared at 177 an inner Assignment to Assignment function 178 level, function identifier not allowed here to a function Multidefined File You 181 of value variant. type not a bounds to of be appears more that has an array once in the of a file type. are too large to allow the elements of the correctly. The expression must specify are not a scalar value; structured variables legal. $IMMED, $DESCR, External procedure Formal $STDESCR at most Formal has allowed only procedure name as main program names must be 20 name value that at most is defined is Illegal dynamic passed for 20 as a can have parameters formal parameter have dynamic array parameters as a parameter. parameter to 'a procedure assignment involving array assignment The program attempts dynamic only parameters. procedures may not itself external unique. You cannot pass a dynamic array as a that in allowed EXTERN, same procedures may have A procedure 187 the Expression must be scalar Program and 186 than components These 'extended parameter specifiers are procedures and functions which are declared 185 within allowed file accessed procedure/function 184 only Array bounds too large array 183 file field record cannot declare The 182 is allowed record variant A constant tag definition of a 179 identifier block. to perform an arrays. A-12 illegal DIAGNOSTIC MESSAGES 188 Parameter must be scalar and not real or double The parameters to the predeclared functions SUCC and PRED must be scalar types, and cannot be one of the real types. 189 Actual parameter must be a variable When you use VAR with a formal parameter, the corresponding actual parameter must be a variable and not a general expression. 190 READLN/WRITELN/PAGE are defined only for textfiles The predeclared procedures READLN, WRITELN, and PAGE operate only on 191 text files. READ/WRITE require input/output parameter list The READ and WRITE procedures require you cannot omit the parameter list. 192 at least one parameter; Illegal type of input/output parameter Arrays, sets, records, and pointers cannot be parameters READ 193 and WRITE the to procedures. Field width parameter must be of type INTEGER The field width you specify must be an integer. 194 Variable must be of type PACKED ARRAY[l..11l] OF CHAR The DATE and TIME procedures require a parameter of this type. 195 Type of variable must be pointer The statement syntax requires a variable of pointer type. 196 Type of variable does not agree with tagfield type The type of a variable in a tag value list is the 197 tag field with (single- or Type of parameter must be REAL or DOUBLE The statement double-precision) 198 incompatible type. syntax value. requires a real Type of parameter must be DOUBLE The statement syntax requires a double-precision value. A-13 DIAGNOSTIC 199 Parameter must The procedure be or of numeric function MESSAGES type requires an integer and not or real number value. 200 Parameter The must be procedure scalar or or function scalar, Boolean, integer or pointer parameter. 201 Error A real is 202 in real constant: constant pointer requires subrange, digit contains a an real integer, user-defined user-defined scalar subrange, expected nonnumeric character where a numeral required. String constant must not exceed The end of string. the line Make occurs sure that source before the the second line apostrophe apostrophe that has not range of closes been a left out. 203 204 Integer constantvexceeds An integer constant (that is, -2%*3]1 to 2**31-1), Actual not The parameter actual Zero You 206 Illegal An 207 length cannot Real or specify or numbers of not a or the correct 1is not permitted integers type compatible in type with the parameter. allowed string in octal or hexadecimal double A singlepermitted formal string digit octal is outside parameter corresponding 205 is range that hexadecimal constant constant has out of no characters. constant contains an illegal digit. range double-precision real number is outside the -- 0.29*10**(-38) to 1.7*(10**38) for positive -0.29*10**(-38) to -1.7%(10**38) for negative range and numbers. 208 Data type This variable contains a cannot be initialized a type that file. A-14 cannot be initialized, such as DIAGNOSTIC MESSAGES 209 Variable has been previously initialized You can specify only one VALUE declaration for a variable. 210 Variable is not array or record type The VALUE initialization for a variable that is not a an array contains 211 a record or constructor. Incorrect number of values for this variable The VALUE declaration contains too many or too few values for the variable 212 being initialized. Repetition factor must be positive be a The optional type identifier must be compatible with the type of The repetition factor positive 213 integer array an in initialization must constant. Type identifier does not match type of variable variable 214 integer constant to be initialized. Incorrect type of value element other type A constant appearing in a VALUE initialization has a of the variable, record field, or array element to be that than initialized. 215 RMS record size is out of range The record size specified in the OPEN procedure call exceeds the maximum, 216 Type OLD is not allowed for this You cannot 217 specify OLD for an file internal file. $DESCR, %STDESCR not allowed for procedure or function parameters The only extended mechanism specifier that PROCEDURE and FUNCTION parameters is $IMMED. 218 may be applied Array must be unpacked An array parameter to PACK or UNPACK is not unpacked correctly. 219 Array must be packed An array parameter to PACK or UNPACK is not packed correctly. A-15 to DIAGNOSTIC 220 Packed The 221 bounds $STDESCR This 222 of not must not the packed allowed mechanism packed dynamic $DESCR not This 223 bounds mechanism types $IMMED not for this specifier may CHAR of for this specifier and to allowed exceed bounds the unpacked bounds. type be applied indexed only by to strings and may be this applied arrays of only these to the predefined types. type This mechanism specifier may be applied only to types that 4 bytes or less, or to PROCEDURE or FUNCTION parameters. 224 $DESCR, %IMMED, You cannot specifiers 225 combine with Too many You can occurs 251 255 Too have with many for VAR %DESCR, VAR scopes only each 20 $%STDESCR, specifier. or can be nested This is generated error function function with Too many errors The PASCAL parameters and %IMMED mechanism same on statement that too expression 1is not identifiers of nesting. and/or no not A new nesting more functions than allowed when a source diagnoses level statement. 20 levels here. function deep. Probable is name/scope nested inside name. this compiler OPEN a line only the first 20 errors line. Expression should the the WITH nested procedures to The of levels block Assignment conflict source 259 allowed an attribute in the compiler. nested Subprograms 252 the the not occupy Iilegal file attribute specification You specified recognized by 250 3%STDESCR to integer. type unpacked for unpacked array arrays allowed scalar exceed MESSAGES on each complicated is too deeply separately evaluate nested. some A-16 parts To correct of the this error, expression. vyou DIAGNOSTIC MESSAGES 260 Too many nonlocal labels The subprogram contains more than 1000 labels that that is, at a higher level, 261 not locally declared. declared are Declarations out of order or repeated declaration sections labels, Only the in the following order: The declarations must be variables, values, and subprograms. types, constants, main program can contain value declarations. 263 Program segment too large: branch displacement 32767 exceeds bytes A statement is too large to allow the generation of a branch Use subprogram calls to break instruction to span the statement. the program into smaller units. 300 Division by zero The program attempts 302 Index expression out of bounds The value subscripts 303 to divide by zero. of of the 1is expression outside the range of the this array. is out of bounds Value to be assigned The value to the right of the assignment operator is out of range for the variable to which it is being assigned. 304 Element expression out of range The value of the expression is out of range for the array element to which you are assigning 305 it. Dimension specification out of range The second dimension argument greater to than LOWER UPPER or array parameter the number array specifies an exceeds range of dimensions of the first argument. 306 Index type declaration of dynamic The index type of the actual dynamic array parameter beyond the range declared in the formal parameter list. 401 Warning: of extends 1Identifier exceeds nn characters Identifiers can be any length, but PASCAL scans only the first 15 characters for uniqueness. A-17 DIAGNOSTIC 402 Warning: Error A compiler 403 404 Warning: Source compiler the program. Warning: in option specification option The MESSAGES is incorrectly input ignores Duplicate after any specified "END." the source the END that code. ignored characters external in after procedure terminates name Two external procedures or functions have been declared with the same name, They refer to the same externally compiled subprogram. 405 Warning: The a LABEL Declaration compiler ignores label in module ignored declarations at the outermost level module. 450 Nonstandard Pascal: Exponentiation 451 Nonstandard Pascal: Value 452 Nonstandard Pascal: OTHERWISE 453 Nonstandard Pascal: $INCLUDE directive 454 Nonstandard MODULE declaration 456 Nonstandard Pascal: '$' '_' 457 Nonstandard Pascal: Dynamic arrays 458 Nonstandard Pascal: $IMMED, $%DESCR, 459 Nonstandard Pascal: Octal 460 Nonstandard Pascal: Double 461 Nonstandard Pascal: External procedure 462 Nonstandard Pascal: Octal hexadecimal 463 Nonstandard Pascal: Output 464 Nonstandard Pascal: Input of Pascal: declaration OR or clause in identifier(s) of $STDESCR hexadecimal precision or or constant constant declaration data user-defined string A-18 parameter or output scalar user-defined scalar in DIAGNOSTIC MESSAGES 465 Nonstandard Pascal: Input/output of double precision data 466 Nonstandard Pascal: Implementation-defined type, function, or procedure A.2 RUN-TIME ERROR MESSAGES message the run-time, at When an error occurs aborts execution. and VAX-11] PASCAL issues an error The run-time error messages appear in format: $PAS~-F~-code, Text code An abbreviation of the message text. by this Messages are alphabetized code. Text The explanation of the error. messages several Some conditions, particularly I/O errors, may cause The first message is a general diagnostic specifying printed. be to the file being accessed (if any) when the error occurred. Then a more be issued to clarify the nature of the may message PASCAL specific most In Finally, a VAX-11 RMS error message may be printed. error. be able to understand the error by looking up the should you cases, VAX/VMS the to If not, refer first two messages in the list below. and Recovery Procedures Manual for an explanation of System Messages the VAX-11l RMS error message. ATTDISINV Attempt to dispose invalid pointer value xxx at PC = XXX The DISPOSE procedure was called with an illegal parameter value, You should use the probably because of an uninitialized pointer. NEW procedure to correctly allocate the pointer. CASSELBOU CASE selector out of bounds at PC = xxXx not does expression selector case the statement, In a CASE case label values, and no OTHERWISE the of one to correspond CHECK the only when This message occurs clause is specified. option is ERRACCFIL Error in effect. in accessing file nnnnnn This message identifies the file being accessed when an I/O error occurred. ERRCLOFIL Error closing file an 1is This closed. being An error occurred while a file was Please PASCAL error and should be reported to DIGITAL. internal example submit a Software Performance Report (SPR), including an program if possible. A-19 DIAGNOSTIC ERROPECRE Error opening/creating An error file. occurred The defaults, the Error ERRREWFIL resetting program Error An error This 1is the was system could This are FILNOTCLO Files not allocated not find in are the probably procedure. reported to Report (SPR), enough that space too to many files be closed allocate are open the or too file many use. call CLOSE OUTPUT cannot for opened type not the predeclared by user file wvariables INPUT with invalid parameters to open for direct access (DIRECT) with variable-length records. Input system conversion found Invalid same option when element open the a file of type TEXT, error erroneous assignment dimension. you appropriate The program tried to another. For the the used) the (or file means OUTPUT You tried or a file each create execution of the RESET procedure. This error and should be reported to DIGITAL. Performance Report (SPR), including an not INPUT and cannot FILTYPNOT File INVASGINC or procedure file You can specify only a carriage control predeclared file variable OUTPUT. The open OUTPUT. FILOUTINV File INPCONERR to OPEN possible. rewriting buffer buffer. You and is 1in Please submit a Software Performance an example program if possible. FILBUFNOT File pointers attempted occurred during execution of the REWRITE an internal PASCAL error and should be DIGITAL. including The system specified An error occurred during is an internal PASCAL Please submit a Software example file if the OPEN procedure for this file. incorrect ERRRESFIL when parameters MESSAGES of input when reading incompatible a text dynamic arrays assign incompatible dynamic assignment to be legal, the type and This message the same upper appears only and if file. at PC arrays to arrays must lower CHECK bounds is = xxx one have for enabled. DIAGNOSTIC MESSAGES LINLENEXC Line length exceeded, The line length = xxx length of an output line was greater than the maximum allowed Check to be sure that you did the record size for this file. by write must If you procedure. not omit a call to the WRITELN size in the OPEN record the increase 1length, this of lines statement. LINLIMEXC LINELIMIT exceeded, LINELIMIT = XXX the exceeds file specified the The number of lines output to limit. Make sure that the excessive output was not caused by an infinite loop and increase the line limit if necessary. OUTCONERR Output conversion error text a to The program tried to write data of an incorrect type file. Make sure that all output values are properly defined. PROEXCHEA Process exceeds heap maximum size at PC = XXX The system could not find enough space to allocate storage for a pointer wvariable. This error is probably caused by an infinite loop that calls the NEW procedure, thus attempting to allocate an infinite amount of heap storage. If the program does not include an infinite loop, your process may actually require more heap 1In this case, try than the maximum process size allows. storage to make your program smaller; 1if you <cannot, ask mahager about increasing the maximum process size. your system PROEXCSTA Process exceeds stack maximum size at PC = xxx The system could not expand the stack to make room for the last procedure or function called. This error is probably caused by infinite recursion, where a number of procedures and functions call each other without returning. Make sure that the program logic If the program does not include this type of logic error. is sound, the process may actually require more space than the your make to try case, 1In this maximum process size allows. you cannot, ask your system manager about if smaller; program increasing the maximum process size. RESREQACC RESET required before accessing are open for before trying to You can use the FIND procedure only on files that input. RESREQREA RESET required before reading the file The program did not call the RESET read the file. A-21 procedure DIAGNOSTIC REWREQWRI REWRITE required The program did not write to the file. SETASGBOU The Set assignment program tried to before call out The Subrange of writing to REWRITE procedure bounds assign Make sure that all set the bounds of the set. enabled. SUBASGBOU the MESSAGES PC trying to xxx set variable. are within CHECK is out illegal = before assignments specify values that This message appears only 1if assignment an at file of program tried to assign variable. Make sure that all that are within the bounds of only if CHECK is enabled. bounds value at PC to = a xxx an illegal value to a subrange subrange assignments specify values the subrange. This message appears A-22 APPENDIX B CONTENTS OF RUN-TIME STACK DURING PROCEDURE CALLS Figure B-1 outlines the events that occur during a procedure call shows the contents of the run-time stack after each event. and CONTENTS OF RUN-TIME STACK DURING PROCEDURE CALLS 0 Before procedure call: lower addresses :SP Stack grows calling procedure local data area toward lower addresses :FP higher addresses SP = Stack Pointer FP = Frame Pointer 9 The calling procedure’s actions: First: Decrements SP by 4 times number of parameters & stores actual parameters on stack. parameter 1 called procedure — : parameters parameter n calling procedure local data area FP Second: Calculates “static link” ‘ to allow the called procedure W to find the stack frame of its declaring procedure. Stores static link in R1. Finally: Issues CALLS instruction. Figure B-1 Contents of Run-Time Stack During Procedure Calls CONTENTS OF RUN-TIME STACK DURING PROCEDURE CALLS 9 The CALLS instruction’s actions: Finally: Creates and pushes stack frame. First: Condition handler Pushes parameter count & . fills with zero-bytes to a longword size. 0 procedure n Second: P called stack frame . mask old AP . o FP PC o Sets new argument pointer (AP) equal to current SP. o R2-R11 saved parameter count as needed and zeros - PSW calied . procedure Third: parameters Adjusts stack to a - longword boundary. calling procedure data area e The called procedure’s actions: ] First: Loads base register R11 with the Third: address of the program-level variables. Allocates space for local data and copies value parameters. Second: ocal local AP on stack. data I — oca " Pushes static link (R1) and SP local AP R1 tati static link f condition handier & local data FP Finally: Saves SP at -12(FP). PSW mask called procedure stack frame . -12(FP) local AP — | value parameters old AP FP < PC R2-R11 as needed . parameter count and zeros AP calling procedure parameters calling procedure data area o Figure B-1 (Cont.) —— T N —— Contents of Run-Time Stack During Procedure Calls INDEX A Access, Communication, direct (random), remote, 5-6 sequential, 5-3, DECnet, 5-6 interprocess, network, 5-6 5-4 5-3, 5-4 Actual parameter list, 6-2, 6-3 Address parameters—--see By-reference mechanism count, 6-1 Argument list, 6-1, 6-6 Arguments to PASCAL subprograms, Argument 6-6 program section, task-to-task, 5-6 Compiler error messages, A-1 Compiler listing, 2-3, 2- 8 Compiler qualifiers, 2-1 Compiling a program, 2-1 Concatenating source files, Condition handler, 7-1 data accessible to, 7-4 7-2 establishing, 7-4 example of, 7-8 2-7 default, Array descriptor, 6-4, 6-6 Assigning logical names, 5-2 Attributes, file, 5-4 5-5 function return parameters for, removing, 7-4 8-1 7-5 values, 7-4 request of stack unwind by, 6-6 Bound procedure value, Bounds checking, Buffer size, BRIEF qualifier, 2-2 3-2, 7-6 responses, 3-3 5-4 Condition handling, 7-1 Condition signal, 7-2 Condition symbol, 7-2, 7-6 6-2, By-descriptor mechanism, 6-4 Condition symbol definition By-immediate-value mechanism, 6-2, 6-9 By-reference mechanism, 6-9 By-reference semantics, By-value semantics, 6-2 files, 6-2, 6-6, 6-2, 6-3 1-1 6-1 Library proce- 6-12 Calling standard, procedure, Calling system services, 6-6 Calls, procedure, 6-1 CALLS instruction, 6-1, B-2 CARRIAGE attribute, 5-5 Carriage control, 5-4 Character parameters, 6-11 CHECK qualifier, 2-2, Checking, bounds, 2-2 Commands, ASSIGN, EDIT, LINK, PASCAL, 6-1 2-10 CROSS REFERENCE qualifier (Tinker), 3-2, 3-3 D Data representation, floating-point, 8-8 DEBUG qualifier 2-6 DEBUG qualifier DEBUG qualifier 2-3, 2-6 3-4, 4-2 2-3, Debugger, Command line qualifiers, 2-2, (execution), 4-1 (linker), 3-2, 3-4, 4-1, 4-2, Declaring Run-Time Library procedures, 2-1 RUN, 1-1, 4-1 SHOW CALLS, 4-3 (compiler), 4-3 4- 4 3- 1 1-1, 2-3, CROSS REFERENCE qualifier (compiler), 2-2, 2-3, 2-6, passing, 5-2 1-1, 1-1, listing, 2-12 2-10, CALL instruction, 6-1 Calling conventions, PASCAL, dures, 6-6 Condition value, 6-7, 7-2 format, 7-6 Count field, 5-4 Creating and executing a program, Cross-reference C Calling Run-Time 7-3 system—-defined, 7-2 user written, 7-2, 7-3 6-12 Declaring system services, 6-7, 2-4 6-9 DECnet communications, Index-1 5-6 6-6, INDEX Descriptor, Device, 6-4, 6-2, 6-6 Files, concatenating 1-2 Diagnostic messages, compiler, A-1 to A-19 format of compiler, A-1l 6-6, Filetype, format of run-time, A-19 run time, A-19 to A-22 Direct access, 5-3, 5-4 DIRECT attribute, 5-4, 5-5 Directory, 1-3 Divide by zero, format, 8-9 command, 1l-1 Entry mask, 6-6 Environment, PASCAL system, Environment pointer, 6-6 Format, 8-1 carriage control, 5-4 compiler listing, 2-8 condition value, 7-6 double-precision data, 8-9 file specification, 1-2 floating point, 8-8 listing file, 2-8 OPEN procedure, 5-4 record, 5-3, 5-4 single-precision data, 8-8 FULL qualifier, 3-2, 3-3 Error, compiler, A-1 correction, 4-1 default processing, 7-1 messages, A-1 through A-22 A-1l processing, 7-1, A-1 run time, 7-1, A-19 2-2, 2-3 Establish a condition handler, Function, arguments to, 6-6 as parameters, 6-5 7-4 Executable image, 3-3 EXECUTABLE qualifier, 3-2, 3-3 Executing a program, 1-1, 4-1 Extensions 2-4 External to standard subprograms, declaring reserved PASCAL, external, status, 6-8 return values, 6-5 Run-Time Librar Y , 6-1, return 7-7 ’ 8-9 File, attributes, image, executable, 1-2, shareable, 3-3 6-7 library, 3-5 listing, 2-2, 2-8 map, 3-3, 3-4 MTHDEF.PAS, 6- 7 object, 2-2, 2 -4, status, 3-3 $IMMED FUNCTION specifier, $IMMED mechanism specifier, 6-5 6-3, 6-9 2-6 specifier, Immediate 6-2, value, and 6-3, function 6-5 6-9 names, 6-5 $INCLUDE directive, 6-7 INCLUDE qualifier, 3-2, 3-5 Input by-reference parameters, 5-4 defaults, $IMMED PROCEDURE procedure organization, 5-3 parameter, 6-3, 6-6 sequential, 5-3 SIGDEF.PAS, 6-7 specification, 1-2 File specification Filename, 1-3 6-12 Image, 5-2 3-3 LIBDEF.PAS, 6-2 MTHSRANDOM, 6-12 MTHSTANH, 6-2 6-2 operand, 5-4 characteristics, system service as, 6-7 F Fault, 5-5 Formal parameter, function, 6-5, 6-6 list, 6-2, 6-3 procedure, 6-5, 6-6 EDIT severity code, 7-6 ERROR LIMIT qualifier, 6-7 1-3 Floating-point data, errors involving, 7-7, 7-8 representation of, 8-8 Floating-point operation, 7-7 E numbers, 2-7 FIND procedure, 5-3, 5-5 FIXED attribute, 5-5 Fixed-length records, 5-3, 7-4 Double-precision source, condition symbol definition, 1-3 Input/output, 5-1 Interprocess communication, Index-2 5-5 INDEX N LIBSESTABLISH, 7-4 LIBSREVERT, 7-4 LIB$SSIGNAL, 7-2, 7-4 LIBSSTOP, 7-2, 7-3, 7-4 LIBDEF.PAS file, 6-7 Library files, 3-5 LIBRARY qualifier, 3-2, Library, object-module, Line length, size), LINK LINK maximum Names, logicai, 5-1, 5-2 program section, 8-2 NEW file attribute, 5-4 NOCARRIAGE attribute, 5- 5 Nonstandard features, 2- 4 3-5 3-5 (buffer 5-4 (o) i command, 1-1, 3-1, 8-2 command qualifiers, 3-2, input Object code listing, 2-10, 2-11 Object file, 2-2, 2-4, 2-6 OBJECT qualifier, 2-2, 2-4, 2-6 OLD file attribute, 5-4 OPEN procedure parameters, 5-4 Optional parameters, 6-11 Options--see qualifiers Output by-reference parameters, file qualifiers, 3-5 Linking the object modules, 3-1 List, argument, 6-1 LIST carriage control format, 5-5 LIST qualifier,*2-2, command line, 2-5 file specification 2-3 6-9 for, 2-3 code, Object 4-2 Linker floating, Overflow, 2-3, files produced by, 2-3, 2-6 specified in source code, 2-6 cross~reference, 2-3, Parameter lists, Parameters, character, 2-10, 2-12 6-9 OPEN procedure, optional, Mailbox, Map 2-11 passing mechanisms, 6-3 by-descriptor, 6-2, default, Passing 2-2 6-6 6-4 by-immediate-value, 6-2, by-reference, 6-2, 6-9 6-3 6-2 parameters, by default mechanism, 6-2 by-descriptor, 6-2, 6-4 by-immediate value, 6-2, 6-3 by-reference, 6-2, 6-9 to OPEN procedure, 5-4 to PASCAL subprograms, 6-5 to Run-Time Library procedures, 6-2 Messages, compiler, A-1 run-time, A-19 MTHDEF.PAS file, subprograms, Passing mechanisms, $IMMED FUNCTION, 6-5 $IMMED PROCEDURE, 6-5 $STDESCR, 6-4 VAR, 6-2 PASCAL command, 1-1, 2-1 PASCAL command qualifiers, arguments passed to, 3-3 MAP qualifier, 3-2, 3-3 Mechanism arrays, 7-4 Mechanism specifier, default, 6-2 $DESCR, 6-4 $IMMED, 6-5, 6-6 signal, 7-4, 7-5 VAR, 6-2, 6-6, 7-4 PASSINPUT, 5-1 PASSOUTPUT, 5-1 PASCAL 5-5 file, 5-4 6-11 PASCAL subprogram, Machine code listing, 2-10, 2-11 MACHINE_ CODE qualifier, 2-2, 2-10, 6-11 formal procedure, 6-5, 6-6 input and output by-reference, Listing file, 2-2 format of, 2-8, 2-9, 2 -10 when produced, 2-3, 2- 6, 2-7 Logical names, 5-1, 5-2 2-6, 6-3 6-2, 7- 5 4 condition handler, 7-4, formal function, 6-5, 6-6 machine code, 2-10, 2-11 source code, 2-10, 2-11 traceback, 4-1 2-3, 7-4 P 2-6 Listing, 5-6 Network communications, to 6-7 Index-3 6—-12 system services, 6-9 INDEX Procedure calling Procedure calls, contents of B-1, arguments to, 6-6 6-5 system external, Run-Time Program stack, service, service, 6-1, 6-1, development sections, names, 7-3 5-5 6-1 process, 1-1, 2-2, 2-1 2-6 2-2, 2-3, OBJECT, 2-2, 2-3 2-6 2-2, 2-3, 2-4 2-6 Sequential access, SEQUENTIAL attribute, Sequential Shareable files, 5-3 image, 3-3 SHAREABLE qualifier, 2-4, 2- SHOW CALLS command, WARNINGS, 2-2, 2-4, 22— SIGDEF.PAS file, BRIEF, 3-3 CROSS 3-2, REFERENCE, DEBUG, 3-2, EXECUTABLE, FULL, 3-2, 3-2, 3-2, 3- 5 LIBRARY, 3-2, 3- 5 3-2, TRACEBACK, 3-2, 3-3 3-2, 3-4, 4-1 command, source code, 2-4, 2-6 (direct) access, Record access Record formats, Record Management mode, listing, qualifiers, Source files, 5- 4 size, maximum, 5-4, Record type, 5-4, Records, fixed-length, 5-3, 5-5 variable~length, 5-3, 5-4, arrays, packed sets, packed records, pointer types, 5-5 2-7 2-4, 8-4 8-4 types, 8-4, 8-2 arrays, unpacked records, 8-3 sets, 8-3 Index-4 8-3 6-4 6-1 arguments to, external, 6-2 Subprograms 8-6 8-2 unpacked Subprograms, 5-5 2-2, allocation, unpacked String descriptor, 5-4 2-11 2-6 concatenating, qualifier, packed scalar 5-5 Record 2-10, 2-6 Storage 5-3, 5-4 Services, represen- code 5-3 5-3, 7-5 8-9 code R Random data Source 2-5 Qualifiers, 7-4, Source STANDARD 3-3 7-4 7-3, 7-4 7-2, condition, 7-2 Single-precision tation, 8-8, PASCAL 3-2, 4-3 6-7 parameters, LIBSSTOP, Signals, 3-3 SHAREABLE, Qualifiers, 3-3 3-3 3-2, 5- 4 5-4 Signal procedure, LIBSSIGNAL, 7-2, 3-3 INCLUDE, MAP, Signal 3- 1 3-4, 4-1 6-11 5-3, 2-2, linker, 6-1 7-4 7-8 STANDARD, Qualifiers, A-19 S 2-2 2-3, CODE, 4-1 7-4 2-6 LIMIT, 7-4 8-9 A-22 LIBSREVERT, ERROR 7-7, messages, MTHSRANDOM, 6-12 MTHSTANH, 6-2 optional parameters, REFERENCE, LIST, 1-1, error 5-7 handler, fault, LIBSESTABLISH, LIBSFIXUP FLT, compiler, DEBUG, 2-2, 6-6, Run-Time Library procedure, declaring, 6-12 8-1 CROSS MACHINE command, through 6-9 8-1 2-2, 5-4, Run-time 6-12 Q CHECK, 6-2, 5-6, operand RMS, 8-2 Qualifiers, by, condition Resignal, RUN 6-2 Library, attributes, access, a Routines, 6-9 1-2 Program Remote Remove Reserved parameters, declaring pass 6-9 run-time 6-1 system Reference, 6-1 B-2 Procedures, as standard, as 6-6 parameters, 6-5 INDEX Symbol, condition, System services, 7-2, Broadcast (SYS$BRDCST), 6-4 Create Mailbox (SYSSCREMBX), 5-5, 6-7, 6-9, 6-10 declaring as functions, (SYSSGETTIM), User-written condition handler, 6-7 declaring as procedures, 6-9 Get Job/Process Information (SYSSGETJPI), 6-13 Get Time U 7-6 6-3, vV Value semantics, Values, condition, 7-6 function return, 6-11 naming, 6-6 optional output parameters, from, parameters 6-1 1 6-10 to, 6-9 Translate Logical Name (SYSSTRNLOG), 6-11 unwind (SYSSUNWIND), 7-6 Wait for Single Event Fl ag (SYSSWAITFR), 6-3 T Task~to-task communication, 5~ 6 Text file, carriage control, 5-5 maximum line length, 5-4 Traceback information, 3-4 [ 4- 1 TRACEBACK qualifier, 3-2, 3_ 4 4 4-1 6-2 signal VAR procedure, parameters, 6-5 7-5 6-2, 6-3, 6-6, 7-4 VARIABLE attribute, 5-5 Variable-length records, 5-4, 5-5 Version, 1-3 5-3, W Warning messages, A-17 WARNINGS 2-2, qualifier, 2-4, 2-2, A-1, 2-4, 2-6 Writing a condition y4 Zero Index-5 divide, 7-4 handler, 7-3 VAX-11 PASCAL User's Guide AA-H485A-TC READER'S NOTE: COMMENTS This form is for document comments only. DIGITAL will use comments submitted on this form at the company's discretion. If you require a written reply and are eligible to receive one under Software Performance Report (SPR) service, submit your comments on an SPR form. Did you find this manual understandable, usable, Did you find errors in this manual? If so, ' and well-organized? specify the error and the page number. Please indicate the type of reader that you most nearly represent. Oodood Please cut along this line. Please make suggestions for improvement. - Assembly language Higher-level programmer language programmer Occasional programmer (experienced) User with little programming experience Student programmer Other (please specify) Name Date Organization Street City. State Zip Code or Country — — Do Not Tear - Fold Here and Tape — — — — — _— = = — = = — — - —_ ] No Postage | Necessary | if Mailed in the | | United States BUSINESS REPLY MAIL FIRST CLASS PERMIT NO.33 MAYNARD MASS. POSTAGE WILL BE PAID BY ADDRESSEE RT/C SOFTWARE PUBLICATIONS TWwW/A14 DIGITAL EQUIPMENT CORPORATION 1925 ANDOVER STREET Do Not Tear - Fold Here @~ @ — — — — — — — — — — — — — — — — - - - — Alnsvva Maddnd ¥ 2an — 01876 Mt TEWKSBURY, MASSACHUSETTS
Home
Privacy and Data
Site structure and layout ©2025 Majenko Technologies