HP Pascal/iX Reference Manual HP 3000 MPE/iX Computer Systems Edition 5 Manufacturing Part Number: 31502-90022 E0692 U.S.A.
Notice The information contained in this document is subject to change without notice. Hewlett-Packard makes no warranty of any kind with regard to this material, including, but not limited to, the implied warranties of merchantability or fitness for a particular purpose. Hewlett-Packard shall not be liable for errors contained herein or for direct, indirect, special, incidental or consequential damages in connection with the furnishing or use of this material.
Preface Printing History New editions are complete revisions of the manual. Update packages, which are issued between editions, contain additional and replacement pages to be merged into the manual by the customer. The dates on the title page change only when a new edition or a new update is published. No information is incorporated into a reprinting unless it appears as a prior update; the edition does not change when an update is incorporated.
This manual is organized as follows: Chapter 1 Introduces HP Pascal. A summary of extensions to ANSI/IEEE 770 X3.97-1983 and ISO 7185-1983 standard Pascal is included. Chapter 2 Describes the language elements in HP Pascal. Chapter 3 Describes HP Pascal's data types. Chapter 4 Defines the expressions used in HP Pascal. Chapter 5 Describes the parts of the declaration section in HP Pascal. Chapter 6 Discusses the statements used in HP Pascal.
* MPE/iX Commands Reference Manual, Volumes 1 and 2 and 32650-90364) * MPE/iX Intrinsics Reference Manual * MPE/iX Symbolic Debugger User's Guide * MPE/iX System Debug Reference Manual * PA-RISC 1.
COMMAND FileName [OPTION ] [Parameter ] Conventions (continued) [...] In a syntax statement, horizontal ellipses enclosed in brackets indicate that you can repeatedly select the element(s) that appear within the immediately preceding pair of brackets or braces. In the example below, you can select Parameter zero or more times. Each instance of Parameter must be preceded by a comma: [,Parameter ][...
Pascal Specific Conventions The conventions followed in this manual are summarized below: For Text: * The term PAC is used for the type PACKED ARRAY OF CHAR with the lower bound equal to 1. * Reserved words and directives are in all uppercase letters. Examples: * BEGIN, REPEAT, FORWARD Standard identifiers are in all lowercase letters. Examples: * readln, maxint, text General information concerning an area of programming (topic) appears as a heading with initial capitalization.
P- 6
Chapter 1 Introduction HP Pascal originates from the Pascal language developed by Nicklaus Wirth in 1968. Wirth's Pascal is based on the ALGOL 60 programming language. His objective was to introduce Computer Science students to "good programming practices." Since then, Pascal has undergone extensions, particularly in its input-output capabilities. This has helped it become a dominant language not only in the academic world, but also in major commercial software projects.
the operator and assignment compatibility rules as follows: * If T1 and T2 are PAC variables or string literals they are compatible. The shorter is padded with blanks for comparison. * If T1 is a PAC variable and T2 is a string literal or PAC variable, then T2 is assignment compatible with T1 provided that T2 is shorter than or equal to T1. If T2 is shorter than T1, T2 is padded with blanks. CASE Statement.
Table 1-0. (cont.) HP Standard Options ANSI LINES LIST PAGE PARTIAL_EVAL RANGE STANDARD_LEVEL System Programming Options EXTNADDR TYPE_COERCION System-Dependent Compiler Options: MPE/iX Only MPE/iX and HP-UX CALL_PRIVILEGE EXEC_PRIVILEGE FONT HP3000_16 HP3000_32 RLFILE RLINIT Refer to Chapter 12 INCLUDE INCLUDE_SEARCH NLS_SOURCE SYMDEBUG HP-UX Only CONVERT_MPE_NAMES[REV BEG] GPROF HP_DESTINATION SHLIB_CODE[REV END] SHLIB_VERSION for details about these options. Conformant Array Parameters.
Halt Procedure. The halt procedure causes an abnormal termination of a program. Heap Procedures. The procedure mark saves the allocation state of the heap. The procedure release restores the allocation state of the heap to a state previously marked. This has the effect of deallocating all storage allocated by the procedure new since the time mark was called. Identifiers. The underscore character (_) can appear in identifiers, but not as the first character. File Input/Output.
Prompt displays the output buffer without writing a line marker. This allows the cursor to remain on the same screen line when output is directed to a terminal. * The routine associate allows Pascal input/output operations on files that have been opened by the operating system. The routine disassociate disallows these operations. Function Return. A function can return any structured type, except those containing files. That is, a function may return an array, record, set, or string. Longreal Numbers.
A variable of type string can be compared with a similar variable or a string literal or can be assigned to a variable of type string. A string literal can be assigned to a variable of type string. The following standard procedures and functions manipulate strings: * Setstrlen contents. * Str * Strappend appends one string to another. * Strdelete deletes a specified number of characters from a string. * Strinsert inserts one string into another.
Chapter 2 Language Elements A Pascal program is a sequence of statements that, when executed in a specified order, processes data to produce desired results. The elements of Pascal include basic symbols, reserved words, identifiers, numbers, comments, separators, and literals. The statements are made up of different elements depending on the needs of the program. This chapter describes in detail the elements of statements in the HP Pascal language.
Table 2-1. Special Symbols (cont.) -------------------------------------------------------------------------------------------| | | | Symbol | Description | | | | -------------------------------------------------------------------------------------------| | | | : | Denotes a statement label, list of case constants, or variable | | | identifiers. | | | | -------------------------------------------------------------------------------------------| | | | ^ | Define or dereference pointers, access file buffer.
NOTE At the ANSI and ISO standard level, OTHERWISE, IMPORT, EXPORT, IMPLEMENT, and MODULE are not considered reserved words. The compiler option STANDARD_LEVEL controls whether these identifiers are recognized as reserved words. Refer to Chapter 12 for more information about STANDARD_LEVEL. If the system programming extensions are enabled, additional identifiers may be treated as reserved words. Table 2-2.
| IMPORT | Begins module import section. | 7 | | | | | ---------------------------------------------------------------------------------------------| | | | | IN | Set inclusion operator. | 4 | | | | | ---------------------------------------------------------------------------------------------| | | | | LABEL | Begins label definition section. | 5 | | | | | ---------------------------------------------------------------------------------------------| | | | | MOD | Integer modulus operator.
| | | | ---------------------------------------------------------------------------------------------| | | | | WITH...DO | Opens record scopes. | 6 | | | | | ---------------------------------------------------------------------------------------------- Identifiers An HP Pascal identifier consists of a letter preceding an optional character sequence of letters, digits, or the underscore character (_) up to a source line in length with all characters significant without respect to case.
Example GOOD_TIME_9 good_time_9 gOOd_TIme_9 { These identifiers { are { equivalent. } } } x2_GO a_long_identifier Boolean { Standard identifier.} Scope The scope of an identifier is its domain of a program in which it may be used. In identifier can appear anywhere in a block Furthermore, the identifier can appear in in which it is defined. of accessibility or the region general, a user-defined after its definition.
PROCEDURE writeit; CONST x = 'LOCAL AND GLOBAL IDENTIFIERS DO NOT CONFLICT'; BEGIN write (x) END; {writeit} BEGIN { show_scope } x:= asterisk; write (x); writeit; write (x); writeln; END. { show_scope } RESULTS: *LOCAL AND GLOBAL IDENTIFIERS DO NOT CONFLICT* Numbers HP Pascal recognizes three kinds of numeric literals: longreal. integer, real, and Integer Literals An integer literal consists of a sequence of digits from the subrange 0 through 9.
Example 100 -100 { unsigned integer { signed integer } } Real and Longreal Literals A real or longreal literal consists of a coefficient and a scale factor. An E preceding the scale factor is read as times ten to the power of and specifies a real literal. An L preceding scale factor also means times ten to the power of, but specifies a longreal literal. Lowercase e and l are legal. At least one digit must precede and follow a decimal point.
Signed Real: Example 0.1 5E-3 3.14159265358979L0 87.35e+8 { { { { Real with no scale factor. Real with no decimal point. Longreal. Real. } } } } Comments Comments consist of a sequence of characters that starts with either of the equivalent symbols { or (*, and end with either of the equivalent symbols } or *). Comments are used to document a program. Since a comment is a separator, it may appear anywhere in a program where a separator may appear. However, nested comments are not legal.
Separators A separator is a space, a tab, an end-of-line marker, a compiler option, or a comment. Separators are used to separate reserved words, identifiers, numbers, strings, and special symbols. At least one separator must appear between any pair of consecutive identifiers, numbers, or reserved words. When one or both elements are special symbols, however, the separator is optional. Separators may not appear within special symbols having more than one component (:=, for example).
Example 'Please don''t!' { Single quote character. } 'A' '' { Null string.
2-: 12
Chapter 3 Data Types One of the most important contributions and fundamental ideas of Pascal is the formalization of the concept of a data type. A data type is a collection of elements that belong together because they are all formed in the same way and are treated uniformly. There are three categories of data types in HP Pascal.
Figure 3-1. HP Pascal Data Types Simple Types The simple data types are made up of ordinal, real, and longreal types. Ordinal types include the standard types integer, char, and Boolean as well as enumerated, subrange, shortint, longint, bit16, bit32, and bit52 types.
Ordinal Ordinal types are types that have a one-to-one correspondence with a subset of natural numbers. These values are ordered so that each has a unique ordinal value that indicates its position in a list of all the values of the type. Ordinal types include bit16, bit32, bit52, Boolean, char, enumerated, integer, shortint, longint, and subrange. Enumerated types are declared by enumerating all the possible values of the type.
NOTE For relational tests, the two operands must be compatible types. When membership tests are performed, the left-operand type must be a single ordinal value, while the right-operand is of a SET type. Bit16. The predefined data type bit16 is a subrange, 0..65535, that is stored in 16 bits. bit16 is a unique HP Pascal type because arithmetic operations on bit16 data are truncated to modulo 65536 when stored.
relational <, <=, =, <>, >=, >, IN arithmetic +, -, *, /, DIV, MOD Standard Functions bit32 argument - abs ln sin arctan odd sqr chr ord sqrt cos pred succ exp bit32 return - pred sqr succ Standard Procedures prompt read readdir readln NOTE strread strwrite writedir writeln The multiply operator (*) may cause overflow traps. "OVFLCHECK" .
Standard Functions bit52 argument - exp pred arctan ln sin chr odd sqr cos ord sqrt bit52 return - abs succ pred sqr succ Standard Procedures prompt read readdir readln strread strwrite writedir writeln Example $standard_level 'hp_modcal'$ program bits3(output); var q:bit52; begin { one way to get bit52 constants >= 2 ** 31 } $push; type_coercion 'conversion'$ q:=bit52(123456) * 1000000000 + 789012345; $pop$ writeln(q); end. Output: 123456789012345 Boolean.
Standard Procedures prompt read readdir readln strread strwrite writedir writeln Example VAR left_handed: Boolean; BEGIN left_handed := false; END; Char. The char type is a predefined ordinal type that is used to represent individual characters in the 8-bit ASCII character set. A char literal is either a single character surrounded by single quote marks, or a sharp (#) followed by a number or letter.
information. Syntax Enumerated_id_list: Permissible Operators assignment := relational <, <=, =, <>, >=, >, IN Standard Functions enumerated argument - ord pred succ enumerated return - pred succ Standard Procedures prompt read readdir readln strread strwrite writedir writeln Example TYPE days = (monday, tuesday, wednesday, thursday, friday, saturday, sunday); color = (red, green, blue, yellow, cyan, magenta, white, black); Integer.
odd sqr cos ord succ abs maxpos round strmax binary octal sqr strpos hex ord sqrt succ lastpos position strlen trunc linepos pred integer return - chr Standard Procedures halt prompt read readdir readln strread strwrite writedir writeln Example VAR wholenum: i,j,k,l : integer; integer; Longint. The predefined data type longint that is stored in 64 bits. is an integer in the range -263..
$standard_level 'hp_modcal'$ program prog(output); var q:longint; begin { one way to get longint constants >= 2 ** 31 or < - 2 ** 31 } $push; type_coercion 'conversion'$ q:=longint(123456) * 1000000000 + 789012345; $pop$ writeln(q); end. Output: 123456789012345 Shortint. The predefined data type shortint is an integer in the range -32768..32767 that is stored in 16 bits. (In contrast, if you declare a variable to be in that range, it is stored in 32 bits.
A subrange type is a user-defined, ordinal type that is a sequential subset of a predefined or user-defined, ordinal base type. It consists of a lower bound and an upper bound separated by the special symbol "..". The upper and lower bounds must be constant values or constant expressions of the same ordinal type. The lower bound cannot be greater than the upper bound.
real argument - abs ln sqr arctan round sqrt cos sin trunc abs exp sqr arctan ln sqrt cos sin exp real return - Standard Procedures prompt read readdir readln strread strwrite writedir writeln Example PROGRAM show_realnum(output); VAR realnum: real; BEGIN realnum := 6.023E+23; writeln(realnum); END. Output: 6.02300E+23 Longreal The longreal type is a predefined, simple type that represents a subset of the real numbers.
cos sqr exp sqrt Standard Procedures prompt read readdir readln strread strwrite writedir writeln Example VAR precisenum: longreal; BEGIN precisenum:= 1.1234567891L+04; . Structured Types Structured data types are the array, file, record, set, and string types. These data types can be preceded by a packing modifier. The effect of the packing modifier is implementation-defined.
An array is a structured type consisting of a fixed number of components that are all of the same type. The maximum number of components is implementation dependent. Depending on your implementation, refer to the HP Pascal/iX Programmer's Guide or the HP Pascal/HP-UX Programmer's Guide for more information. Syntax Array_type: Array Declarations An array type definition consists of the reserved word ARRAY, an index type in square brackets, the reserved word OF, and the component type.
NOTE One asterisk (*) after a routine name indicates that this routine can be used on all arrays, whereas two asterisks (**) indicates that this routine should be used with PAC arrays only. Example TYPE name list strange flag files = = = = = PACKED ARRAY [1..30] OF char; { PAC type } ARRAY [1..100] OF integer; ARRAY [Boolean] OF char; ARRAY [(red, white, blue)] OF 1..50; ARRAY [1..
File_type: Example TYPE person = RECORD name: PACKED ARRAY [1..30] OF char; age: 1..100; END; person_file = FILE OF person; bit_vector = PACKED ARRAY [1..100] OF Boolean; vector_file = FILE OF bit_vector; data_file doc_file = FILE OF integer; = text; Standard Textfiles text Text type variables are called textfiles. The standard file type text permits ordinary input and output that is oriented to characters and lines. Text type files have two important features: * The components are type char.
BEGIN rewrite(myfile); writeln(myfile,'integer',i); writeln(myfile,'real',r); END. input When the standard textfile input appears as a program parameter, there are several important consequences: * Input code. * The system automatically associates input implementation-dependent physical file. * The system automatically resets input. * If certain file operations omit the logical file name parameter, input is the default file.
A record is a structured type consisting of a collection of components that are not necessarily of the same type. Each component is termed a field of the record and has its own identifier. A field of a record is accessed by using the appropriate field selector. A record type consists of the reserved word RECORD, a field list, and the reserved word END. The reserved word PACKED may precede the reserved word RECORD. If PACKED is used, it instructs the compiler to optimize storage of the record fields.
Variant Part In the variant part, the reserved word CASE introduces an optional tag field identifier and a required ordinal type identifier. The reserved word OF precedes a list of case constants and alternative field lists. Case constants must be compatible with the tag. See "Type Compatibility" in this chapter for more information. Several case constants may be associated with a single field list. The various constants appear separated by commas. Subranges are also legal case constants in HP Pascal.
Permissible Operators assignment (entire record) := field selection . Standard Procedures read readdir write writedir Example TYPE word_type = (int, ch); word = RECORD { variant part only with tag } CASE word_tag: word_type OF int: (number: integer); ch : (chars : PACKED ARRAY [1..
date_info = PACKED RECORD { fixed part only } mo: (jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec); da: 1..31; yr: 1900..2001; END; marital_status = (married, separated, divorced, single); name_string = PACKED ARRAY [1..30] of CHAR; person_info = RECORD { nested variant parts } name: name_string; born: date_info; CASE status: marital_status of married..divorced: (when: date_info; CASE has_kids: Boolean OF true: (how_many: 1..
somefruit = SET OF apple..cherry; poets = SET OF (Blake, Frost, Brecht); some_set = SET OF 1..200; PACKED This reserved word indicates that the compiler should minimize data storage even if the access time may be increased. The reserved word PACKED may appear with an ARRAY, RECORD, SET, or FILE. By declaring a PACKED structured data type, the amount of memory needed to store an item is generally reduced.
A string expression may consist of any of the following: * A string literal. * A string variable. * A string constant. * A function result that is a string. * An expression formed with the concatenation operator. NOTE Variables of type string, as well as other Pascal variables, are not initialized. The current string length contains meaningless information until the string is initialized.
strappend writedir strdelete writeln Example CONST maxlength = 100; TYPE name = string[30]; remark = string[maxlength * 2]; PROCEDURE proc1 (VAR s: string); EXTERNAL; { Maximum length } { not required. } Pointer Types Pointers A pointer is a data type that may reference any type, including type FILE. A pointer references a dynamically allocated variable on the heap. The pointer type consists of the caret (^) and a type identifier. The @ symbol may replace the caret.
ptr1 ptr2 rec1 rec2 = ^rec1; = ^rec2; = RECORD f1, f2: link: END; = RECORD f1, f2: link: END; integer; ptr2; real; ptr1; Type Compatibility Relative to each other, two HP Pascal types can be identical, type compatible, or incompatible. The guidelines that determine type compatibility are listed below. Identical Types Two types are identical if either of the following is true: * Their types have the same type identifier.
compatible. compatible. In the following example, types T1 and T2 are not Variables v3 and v4 are also not compatible. PROGRAM t(input,output); TYPE T1 = record a: integer; b: char; end; T2 = record c: integer; d: char; end; VAR v1: v2: v3: v4: BEGIN v1:= v3:= END.
String Assignment Compatibility Certain restrictions apply to the assignment of string literals or variables of the type string, PAC, or char. These restrictions are listed below. * If T1 is a string variable, T2 must be a string variable or a string literal whose length is equal to or less than the maximum length of T1. T2 cannot be a PAC or char variable. Assignment sets the current length of T1.
3- 28
Chapter 4 Expressions An expression is a construct composed of operators and operands that represent the computation of a result of a particular type. In the simplest case, an expression consists of a single operand with no operator. The type of an expression is known when the expression is written, and never changes. The actual value, however, may not be known until the system evaluates the expression at run time. It may differ for each evaluation.
Syntax Expression: 4-: 2
Selector: Example x:= 19; { Simplest case. "19" is the expression { in the statement: "x := 19". } } 100 + x; { Arithmetic operator with literal and { variable operands. } } (A OR B) AND (C OR D) { Boolean operator with Boolean operands. } x > y { Relational operator with variable { operands. } } setA * setB; { Set operator with variable operands. } 'ice'+'cream' { Concatenation operator with string { literal operands.
Table 4-1.
Table 4-2.
Table 4-2. HP Pascal Operators (cont.
type, and if the operand is bit32 or bit52, the result is a longint. The type of the result of a binary operator is the same as the data types of its operands, provided that both operands are of the same type. Special rules apply for division and in cases where operands have different data types. Implicit Type Conversion of Operands The operators +, -, *, and / permit operands with different numeric types. For example, it is possible to add an integer and a real number.
Real division (/) is an exception to this restriction. If both operands are integer or sub-integer, the compiler changes both to real numbers prior to the division and the result is real. If both operands are super-integers, the result is longreal because both[REV BEG] operands are converted to longreal.[REV END] Example EXPRESSION RESULT -(+10) 5 + 2 5 - 2.0 5 * 2 5.0 / 2.0 5 / 2 -10 7 3.0 10 2.5 2.5 5.0 / 2 { { { { { { { { 2.5 Unary -. Addition with integer operands.
The compiler can be directed to perform or not perform partial evaluation of Boolean operators used in statements. For example: IF right_time AND right_place THEN ... By specifying the $PARTIAL_EVAL ON$ compiler directive, if right_time is false, the remaining operators are not evaluated since execution of the statement depends on the logical AND of both operators. Both operators have to be true for the logical AND of the operators to be true.
Example VAR bit6, bit7 : Boolean; counter : integer; BEGIN ... IF bit6 AND bit7 THEN counter := 0; ... IF bit6 AND (counter = 0) THEN bit7 := true; bit7 := bit6 AND (counter = 0); END NOT This Boolean operator complements the value of the Boolean expression following the NOT operator. The result is of type Boolean. The truth table for NOT is given below.
---------------------------------------| | | | | a | b | a OR b | | | | | ---------------------------------------| | | | | false | false | false | | | | | | false | true | true | | | | | | true | false | true | | | | | | true | true | true | | | | | ---------------------------------------Example PROGRAM show_or(input,output); VAR ch : char; time : Boolean; energy : Boolean; BEGIN . . IF time OR energy THEN do_it; . . IF (ch = 'Y') OR (ch = 'y') THEN ch := 'Y'; . . END.
defines the ordering. For enumerated operands, the sequence in which the constant identifiers appear in the type definition defines the ordering. If both operands are Boolean, the operator = denotes equivalence, <= denotes implication, and <> denotes exclusive OR. Therefore, the predefinition of Boolean as: TYPE Boolean = (false, true); means that false < true. Example PROGRAM show_simple_relational; VAR b: Boolean; BEGIN . . b := 5 > 2; b := 5 < (25.OL+1); END.
Example PROGRAM show_in(output); VAR ch : char; good : SET OF char; member : Boolean; BEGIN ch := 'y'; good := ['y','Y','n','N']; IF ch IN good THEN member := true ELSE member := false; writeln(member); END. Output: TRUE Pointer Relational Operators The pointer relational operators = and <> can be used to compare two pointers for equality or inequality, respectively. Two pointers are equal only if they point to exactly the same object or both contain the value NIL.
* If one operand is a char expression, the other may be a char expression or a single-character string literal. Table 4-4 summarizes these rules. The standard function strmax(s) returns the maximum length of the string variable s. The standard function strlen(s) returns the current length of the string expression s. A string constant is considered a string literal when it appears on either side of a relational operator. Table 4-4.
TRUE TRUE FALSE TRUE Concatenation Operator The concatenation operator + concatenates two operands that may be string variables, string literals, function results of a string type, or some combination of these types. The result of the concatenation is always type string. NOTE It is not legal to use the concatenation operator in a constant definition.
. . a:= b:= c:= x:= a:= b:= c:= c:= END. [1, 3, 5]; [2, 4]; [1..10]; 9; a + b; c - a; a * b; [2, 5] + [x] { { { { { Union; a is now [1, 2, 3, 4, 5]. Difference; b is now [6, 7, 8, 9, 10]. Intersection; c is now []. Set constructor operands; c is now [2, 5, 9]. } } } } } Array Selector An array selector accesses a component of an array. The selector follows an array designator and consists of an ordinal expression in square brackets.
Record Selector A record selector accesses a field of a record. The record selector follows a record designator and consists of a period and the name of a field. A record designator is the variable name of a record, the selected component of a structure that is a record, or a function call that returns a record. The WITH statement "opens the scope" of a record. unnecessary to specify a record selector.
Syntax Set_constructor: Example 1 PROGRAM show_setconstructor; TYPE int_set = SET OF 1..100; cap_set = SET OF 'A'..'Z'; VAR a,b: 0..255; s1: SET OF integer; s2: SET OF char; BEGIN . . s1:=[b, 7, 10]; { no type identifier } s1:= int_set[(a MOD 100) + (b MOD 100)]; s2:= cap_set['B'..'T', 'X', 'Z']; END. Example 2 VAR s1 : set of 0..366; i,j : integer; BEGIN s1 := [i..j] * s1; . . . END. 4-: 18 {in this context, [i..j] becomes a set of 0..366.
File Buffer Selector A file buffer selector accesses the contents, if any, of the file buffer variable associated with the current position of a file. The selector follows a file designator and consists of the caret symbol (^). A file designator is the name of a file or the selected component of a structure which is a file. The @ symbol may replace the caret. If the file buffer variable is not defined at the time of selection, a run-time error occurs.
Example PROGRAM show_pointerderef (output); TYPE p = ^integer; VAR a,b : integer; p_array : ARRAY [1..10] OF p; ptr : p; BEGIN . p_array[a]^:= a + b; . writeln(ptr^ * 2); . END. { Dereferenced pointer is operand. } Function Calls A function call invokes the block of a standard or user defined function and returns a value to the calling point of the program. An operator can perform some action on this value, and, for this reason, a function result is an expression.
Chapter 5 The Declaration Section The first two parts of an HP Pascal block are the heading and the declaration section. The heading specifies the name of the program, module, procedure, or function. The declaration section contains sections that define constants and user-defined types, and sections that declare labels, variables, procedures, functions, and modules. Each of these sections is introduced by an appropriate reserved word such as LABEL, CONST, IMPORT, MODULE, TYPE, VAR, PROCEDURE, or FUNCTION.
CONST This reserved word indicates the beginning of one or more constant definitions that introduces an identifier as a synonym for a constant value. The identifier may then be used in place of that value. Constant definitions appear after the program header or any LABEL declarations, and before any procedure or function definitions. In HP Pascal, CONST, TYPE, VAR, MODULE, and IMPORT definitions may be intermixed.
what := false; lie := NOT true; IF what = lie THEN writeln('Would I lie?'); END. Output: Would I lie? true This predefined Boolean constant is equal to the Boolean ordinal value of true is 1. value true. The Example PROGRAM show_true(output); VAR what, truth : boolean; BEGIN IF true THEN writeln('Always true, always printed.'); what := true; truth := NOT false; IF what = truth THEN writeln('Everything I say is a lie.'); END. Output: Always true, always printed. Everything I say is a lie.
NIL This predefined constant is the value of a pointer that designates that the pointer does not point at anything. NIL is compatible with any pointer type. A NIL pointer or pointer that has been assigned to NIL does not point to any variable at all. It is an error to dereference a NIL valued pointer. NIL pointers are useful in linked list applications where the link pointer points to the next element of the list.
CONST true_values init_values1 init_values2 identity colors = = = = Boolean_table [5 OF true]; table [100 OF 0]; table [60 OF 0, 40 OF 1]; matrix [row [1, 0, 0, 0, 0], row [0, 1, 0, 0, 0], row [0, 0, 1, 0, 0], row [0, 0, 0, 1, 0], row [0, 0, 0, 0, 1]]; = color_array [color_string ['RED', 3 OF ' '], color_string ['YELLOW'], color_string ['BLUE', 2 OF ' ']]; The name of the previously declared constant may be specified within a structured constant.
Example TYPE securtype = (light, medium, heavy); counter = RECORD pages: integer; lines: integer; characters: integer; END; report = RECORD revision: char; price: real; info: counter; CASE securtag: securtype OF light: (); medium: (mcode: integer); heavy: (hcode: integer; password: string[10]); END; CONST no_count = counter [pages: 0, characters: 0, lines: 0]; big_report = report [revision: 'B', price: 19.
Example TYPE digits = SET OF 0..9; charset = SET OF char; CONST all_digits odd_digits letters no_chars no_iden = = = = = digits [0..9]; { Subrange. } digits [1, 1+2, 5, 7, 9]; charset ['a'..'z', 'A'..'Z']; charset [ ]; [2, 4, 6, 8] { No set identifier. } String Constructor A string constant is a declared constant defined with a string constructor that specifies values for a string type. The length of the string constant may not exceed the maximum length of the string type used in its definition.
Example TYPE s = string[80]; CONST blank = ' '; greeting = s['Hello!']; farewell = s['G',2 OF 'o','d','bye']; blank_string = s[10 OF blank]; Label Declaration A label declaration specifies integer labels that mark executable statements in the body of the block. The reserved word LABEL precedes one or more integers separated by commas. Control is transferred to a labeled statement by a GOTO statement. For more information about GOTO statements, see Chapter 6 . Integers must be in the range 0 to 9999.
subsequent use in the definitions of other types. In the only exception to this rule, a base type identifier in a pointer type definition is allowed before the base type is defined. However, the base type must be defined before the end of the TYPE section in which it is first mentioned. TYPE This reserved word delimits the start of the type declarations in a program, module, procedure, or function. A type definition establishes an identifier known as type identifier as a synonym for a data type.
program that imports the module. Several identifiers may be combined in the same variable declaration if the variables are of the same type. HP Pascal predefines two standard variables, input textfiles. Formally, and output, that are VAR input, output: text; These standard textfiles commonly appear as program parameters and serve as default files for various file operations. For more information on textfiles, refer to Chapter 3 .
Example TYPE answer = (yes, no, maybe); VAR pagecount, linecount, charcount: integer; whats_the: answer; album { Standard identifier. } { User-declared identifier. } : RECORD { Data type. speed: (lp, for5, sev8); price: real; name : string[20]; END; } Side-Effects A side-effect is the modification by a procedure or function of a variable that is global or nonlocal in scope to the procedure or function.
5- 12
Chapter 6 Statements A statement is a sequence of special symbols, reserved words, and expressions that either performs a specific set of actions on a program's data or controls program flow. Table 6-1 lists and describes statements. Table 6-1.
Compound Statements A compound statement is a sequence of statements bracketed by the reserved words BEGIN and END. A semicolon (;) delimits one statement from the next. Certain statements may alter the flow of execution in order to achieve effects such as selection, iteration, or invocation of another procedure or function. For instance, after the last statement in the body of a routine has executed, control is returned to the point in the program from which the routine is called.
Example PROCEDURE check_min; BEGIN IF min > max THEN BEGIN writeln('Min is wrong.'); min := 0; END; END; . . . { { { { Compound statement is part of IF statement. } } } } { { { { { { { This compound statement is the procedure's body. } } } } } } } BEGIN { Nested compound statements } IF part_to_start=part_1 THEN BEGIN { for logically grouping statements. } start_part_1; finish_part_1; { empty statement here } END ELSE BEGIN start_part_2; finish_part_2; END; END; ... BEGIN ..
Empty Statements The empty statement causes only the advancement of program flow to the next statement. It is often used to indicate that nothing occurs. In the example, no action occurs when i equals 2, 3, 4, 6, 7, 8, 9, or 10. Example CASE i OF 0 : start; 1 : proceed; 2..4 : ; 5 : report_error; 6..10: ; 11 : stop; OTHERWISE fatal_error; END; IF i IN [2..4,6..10] THEN { do nothing } ELSE { cases } NOTE In the following example, the last semicolon is not required.
Example PROGRAM show_assign(input,output); VAR aaa: integer; FUNCTION show_assign: integer; TYPE rec = RECORD f: integer; g: real; END; index = 1..3; table = ARRAY [index] of integer; CONST ct = table [10, 20, 30]; cr = rec [f:2, g:3.0]; VAR s: integer; a: table; i: index; r: rec; p1, p: ^integer; strg: string[10]; BEGIN { show_assign } s:= 5; i:= 3; a:= ct; a [i] := s + 5; r:= cr; r.f:= 5; new (p1); p:= p1; p^:= r.
Note that statements between OTHERWISE and END need not be bracketed with BEGIN..END. When the system executes a CASE statement, the following occurs: 1. It evaluates the selector. 2. If the value corresponds to a specified case constant, it executes the statement associated with that constant. Control then passes to the statement following the CASE statement. 3. If the value does not correspond to a specified case constant, it executes the statements between OTHERWISE and END.
END; END; . . . . FUNCTION octal_digit (d:digit): Boolean; { TYPE digit = 0..9 } BEGIN CASE d OF 0..7: octal_digit := true; 8..9: octal_digit := false; END; END; . . . . FUNCTION op { TYPE operators=(plus,minus,times,divide) } (operator: operators; operand1, operand2: real) : real; BEGIN CASE operator plus: op minus: op times: op divide: op END; END; IF .. THEN IF .. THEN ..
NOTE ELSE parts are always associated with the nearest preceding unmatched IF statement. A common use of the IF statement is to select an action from several choices. This often appears in the following form: IF e1 THEN ... ELSE IF e2 THEN ... ELSE IF e3 THEN ... ELSE ... This form is particularly useful to test for conditions involving real numbers or string literals of more than one character, since these types are not legal in CASE labels.
. IF s i ELSE i ELSE i END. FOR .. = 'RED' THEN := 1 IF s = 'GREEN' THEN := 2 IF s = 'BLUE' THEN := 3; { This IF statement } { cannot be rewritten as } { a CASE statement. } DO The FOR statement executes a statement a predetermined number of times.
The FOR statement: FOR control_var := initial TO final DO statement is equivalent to the statement: BEGIN temp1 := initial; {No evaluation order is required } temp2 := final; {for temp1 and temp2. } IF temp1 <= temp2 THEN BEGIN control_var := temp1; WHILE control_var <= temp2 DO BEGIN statement; control_var := succ(control_var); { increment } END; END ELSE; { Don't execute the statement at all;} END; { control_var is now undefined.
Example { VAR color: (red, green, blue, yellow); } FOR color := red TO blue DO writeln ('Color is ', color); . . FOR i := 10 DOWNTO 0 DO writeln (i); writeln ('Blast Off'); . . FOR i := (a[j] * 15) TO (f(x) DIV 40) DO IF odd(i) THEN x[i] := cos(i) ELSE x[i] := sin(i); REPEAT .. UNTIL A REPEAT statement executes a statement or group of statements repeatedly until a Boolean expression is true.
Example sum := 0; count := 0; REPEAT writeln('Enter trial value, or "-1" to quit'); read (value); sum := sum + value; count := count + 1; average := sum / count; writeln ('value = ', value, ' average = ',average) UNTIL (count >= 10) OR (value = -1); . . REPEAT writeln (real_array[index]); index := index + 1; UNTIL index > limit; WHILE .. DO The WHILE statement executes a statement repeatedly as long as a given condition is true.
Example WHILE index <= limit DO BEGIN writeln (real_array[index]); index := index + 1; END; . . WHILE NOT eof (f) DO BEGIN read (f, ch); writeln (ch); END; WITH .. DO A WITH statement allows reference to record fields by field name alone. A WITH statement consists of the reserved word WITH, one or more record designators, the reserved word DO, and a statement. A record designator may be a record identifier, a function call that returns a record, or a selected record component.
The statement: WITH record1, record2, ..., recordn DO BEGIN statement; END; is equivalent to: WITH record1 DO BEGIN WITH record2 DO BEGIN ... WITH recordn DO BEGIN statement; END; ... END; END; Therefore, if field f is a component of both record1 and record2, the compiler interprets an unselected reference to f as a reference to record2.f. The synonymous field in record1 can be accessed using normal field selection; for example, record1.f.
Example PROGRAM show_with; TYPE status = (married, widowed, divorced, single); date = RECORD month : (jan, feb, mar, apr, may, jun, july, aug, sept, oct, nov, dec); day : 1..31; year : integer; END; person = RECORD name : RECORD first, last: string[10] END; ss : integer; sex : (male, female); birth : date; ms : status; salary : real END; VAR employee : person; BEGIN {show_with} .
NOTE The use of the non-local label form of GOTO may increase execution time of the program. Syntax Goto_statement Example PROGRAM show_goto (output); LABEL 500, 501; TYPE index = 1..10; VAR i: index; target: integer; a: ARRAY[index] OF integer; PROCEDURE check; VAR answer: string [10]; BEGIN . { ask user if OK to search } IF answer= 'no' THEN GOTO 501; { jumping out of procedure } . END; BEGIN { show_goto } . check; .
procedure declared in a previous procedure declaration. If a procedure declaration includes a formal parameter list, the procedure statement must supply the actual parameters. The actual parameters must match the formal parameters in number, type and order. There are four kinds of parameters: value, reference, procedural, and functional.
BEGIN bow; END; BEGIN {outer} writeln('Hi'); inner; proc_parm; END; {outer} BEGIN { show_pstate } outer(30, bow); END.
Chapter 7 Program Structure An HP Pascal program consists of two major parts: the program heading and the program block. The program block includes the declaration part which consists of definitions of constants and types, and declarations of labels, variables, procedures, functions, and modules. This chapter describes in detail the program heading and program block. This includes the declaration part and module as well as the function and procedure. Below is an example of an HP Pascal program.
program block statements. consists of the declaration part and the statement or The identifiers in the parameter list are variables that must be declared in the outer block, except for the standard textfiles input and output. Input and output are standard file variables that the system associates by default with system dependent files. These files are opened automatically at the beginning of program execution.
NOTE MODULE declarations and IMPORT lists cannot appear in inner blocks such as in procedures or functions. Declaration Part The declaration part consists of definitions of constants and types, and declarations of labels, variables, procedures, functions, and modules. The statement part is made up of a compound statement that may be empty or may contain several simple or structured statements. The statement part is also termed the body or executable portion of the block.
NOTE ANSI/IEEE770X3.97 - 1983 Standard Pascal allows the following reserved words, LABEL, CONST, TYPE, or VAR to be used only once in that order. A predefined constant, type, variable, procedure, or function may be redeclared in a declaration part. However, access to the previous definition associated with that item is lost within the scope in which it is redefined.
Syntax Procedure_declaration: FUNCTION A function is a block that is invoked with a function call and that returns a value. A function declaration consists of a function heading, a semicolon (;), and a block or a directive followed by a semicolon (;). A function heading consists of the reserved word FUNCTION, an identifier that specifies a function name, an optional formal parameter list, and a result type. The result type may be any type, except a file type or a structured type containing a file.
MODULE A module provides a mechanism for separate compilation of program segments. It is a program fragment with a completely defined interface that can be compiled independently and later used to construct programs. A module usually defines some data types, constants, variables, and some procedures and functions that operate on this data. Such definitions are made accessible to users of the module by its export declarations.
more information. In order for a procedure in a module to read from input or write to output (for example, readln from input or writeln to output ), that module must import the standard modules stdinput or stdoutput, respectively. On HP-UX the standard modules stdinput, stdoutput, and stderr are contained in the predefined library /usr/lib/paslib. On MPE/iX the standard modules stdinput and stdoutput are contained in the predefined library PASLIB.PUB.SYS.
EXPORT { Exported TYPE bits8 = 0..
Example EXPORT { Start of export text } TYPE control_num: 0..255; { Exported type } { Exported } VAR last_num: control_num; variable FUNCTION control (i: control_num; flag : Boolean) : Boolean;{Exported function} IMPORT This reserved word indicates which modules are needed to compile a program or module. The IMPORT section is used to name all other modules upon which the present one depends. One module, m1, depends on another, m2, if m1 makes use of the objects exported from m2.
When you want to export modules, as well as procedures and types, insert the reserved word EXPORT following the module name. When EXPORT is used to specify an export of a module, that module is only available to the program or module importing the current module. Syntax Import_declaration: Example 1 In this example, module bit_types is defined in another compilation unit (see example in section "MODULE" ). bit_types is compiled into an object file called mod1.o.
IMPLEMENT END. PROGRAM show_import_export_prog (output); $SEARCH 'mod1.o, mod2.o'$ {Object files that contain bit_types} {and show_import_export. } IMPORT show_import_export; VAR little_bit : bits8; little_byte : byte_rec; { bits8 is defined in module bit_types } {byte_rec is defined in module show_import_export} BEGIN little_bit := 9; little_byte := little_bit; END. IMPLEMENT This reserved word indicates the beginning of the internal part of a MODULE.
7- 12
Chapter 8 Procedures and Functions When a procedure or function is declared, the heading may optionally include a list of parameters. This list is called the formal parameter list. A procedure statement or function call in the body of a block provides the matching actual parameters that correspond by their order in the list. The four kinds of formal parameters are value, reference, functional, and procedural parameters.
* They are both procedural parameters with congruent parameter lists. * They are both functional parameters with congruent parameter lists and identical result types. * They are both either value conformant array specifications or both reference conformant array specifications, and in both cases, the conformant array specifications contain the same number of parameters and equivalent conformant array schemas.
{ Perform an alternate validity check on x, y, z { and return appropriate value. END; } } PROCEDURE read_data (FUNCTION check (a, b, c: real): Boolean); VAR p, q, r: real; BEGIN { read and validate data } readln (p, q, r); IF check (p, q, r) THEN ... END; BEGIN {show_formparm} . IF test THEN read_data (chek1) ELSE read_data (chek2); . END.
{ ADD_Array can be used for arrays of type arr1 and arr2 because they conform to each other.} ADD_Array(a3,a1,a2); ADD_Array(b3,b1,b2); END. { Show_ConformantParm } Conformance A conformable test must be passed to pass an array as an actual conformant array parameter. Actual conformant array parameters must have a type conformable with the conformant array form corresponding to the parameter in the procedure declaration.
Example TYPE inxtype = 0..20; ... PROCEDURE Proc1 ( P1: ARRAY[L1..H1:inxtype] OF ARRAY[L2..H2:inxtype] OF integer; P2: PACKED ARRAY[L3..H3:inxtype] OF integer; P3: ARRAY[L4..H4:inxtype] OF integer; P4: ARRAY[L5..H5:inxtype;L6..U6:inxtype] OF integer); ... VAR V1: PACKED ARRAY[0..10] of integer; V2: ARRAY [3..5,1..10] OF integer; V3: ARRAY[1..50] OF integer; V1 is conformable with P2, but not with P1, P3, and P4. V2 is conformable with P1 and P4, but not with P2 or P3.
FORWARD; . . FUNCTION exclusive_or; { Parameters not repeated. } BEGIN exclusive_or:= (x AND NOT y) OR (NOT x AND y); END; Recursion A recursive procedure or function is a procedure or function that calls itself. It is also legal for procedure A to call procedure B that in turn calls procedure A. This is indirect recursion and is often an instance when the FORWARD directive is useful. Note that when a routine is called recursively, new local variables are created for each invocation of the routine.
Example PROGRAM show_function (input,output); VAR n, coef, answer: integer; FUNCTION fact (p: integer) : integer; BEGIN IF p > 1 THEN fact := p * fact (p-1) ELSE fact := 1 END; FUNCTION binomial_coef (n, r: integer) : integer; BEGIN binomial_coef := fact (n) DIV (fact (r) * fact (n-r)) END; BEGIN { show_function } read(n); FOR coef := 0 TO n DO writeln (binomial_coef (n, coef)); END.
8-: 8
Chapter 9 Standard Routines HP Pascal supplies predefined procedures and functions that perform various commonly used operations. These are listed below, followed by a description of most in the subsequent pages of this chapter. Any procedure or function that is followed by an asterisk (*) is discussed in Chapter 10 .
new Usage new(p ) new(p, t1,...,tn ) Parameters p Any pointer variable. t A case constant value representing tag values for the pointer variable p. Description The procedure new(p ) allocates storage for a dynamic variable on the heap and assigns its identifying value to the pointer variable p. If the dynamic variable is a record with variants, then the tag may be used to specify a case constant. This constant determines the amount of storage allocated.
. . new(p,engaged); . . new(p,married); . . new(p,widowed,false); . . END. { Allocates record with variant engaged.} { Allocates record with variant married.} { Allocates record with variants widowed and false.} dispose Usage dispose(p) dispose(p, t1,...,tn) Parameters p A pointer expression that cannot be NIL or undefined. t A case constant value whose value matches the case constant value specified in new.
VAR p : ptr; BEGIN . . new(p); . . dispose(p); . . new(p,engaged); . . dispose(p,engaged); . . new(p,married,false); . dispose(p,married,true); . . END. { Allocates largest variant. } { Deallocates record with largest variant. } { Allocates record with variant engaged. { Deallocates record with variant engaged. } { Allocates record with variants married and false.} { Error, case constants don't match new. mark Usage mark(p) Parameter p A pointer variable.
release Usage release(p) Parameter p A pointer variable that previously appeared as a parameter in a call to mark, and should not have been previously passed to release or altered by assignment. Description The procedure release(p) returns the heap to its allocation state when mark was called with a parameter that has the value of p. This has the effect of deallocating any heap variables allocated since the program called mark. The system can then reallocate the released space.
e An integer expression. The value of e than the maximum length of s. must not be greater Description The procedure setstrlen(s, e) modifying the contents of s. sets the current length of s to e without If the new length of s is greater than the previous length of s, the extra components become defined, but no value is given to them. No blank filling occurs. If the new length of s is less than the previous length of s, previously defined components beyond the new length become undefined.
strdelete Usage strdelete(s, p, n) Parameters s A string variable. p An integer expression representing the starting index of the deletion. n An integer expression representing the number of characters to be deleted. Description The procedure strdelete(s, p, n) deletes n characters from s starting at component s [ p ] , and the current length of s is updated to the length of s-n. It is an error if n+p-1 is greater than the current length of s. Example VAR uncensored, censored: string[80]; BEGIN .
. END. strmove Usage strmove(n, s1, p1, s2, p2) Parameters n An integer expression indicating the number of characters to be copied. s1 A string expression or PAC variable. p1 An integer expression indicating the index in s1 copying starts. s2 from which A string or PAC variable. p2 An integer expression indicating the index in s2 starts. where copying Description The procedure strmove(n, s1, p1, s2, p2) copies n characters from s1, starting at s1[p1], to s2, starting at s2[p2].
strread Usage strread(s, p, t, v) strread(s, p, t, v1,...,vn) Parameters s A string expression. p An integer expression. t An integer or integer subrange variable. v A simple, string, or PAC variable. may appear separated by commas. Any number of v parameters Description The procedure strread(s, p, t, v) reads a value from s, starting at s [ p ] , into the variable v.
strwrite Usage strwrite(s, p, t, e) strwrite(s, p, t, e1,...,en) Parameters s A string variable. p An integer expression. t An integer or integer subrange variable. e A simple or string expression, or a PAC variable. of e parameters may appear separated by commas. Any number Description The procedure strwrite(s, p, t, e) writes the value of e on s starting at s [ p ] .
str Usage str(s, p, e) Arguments s A string expression. p An integer expression indicating the index of the starting character. e An integer expression indicating the length of the substring. Description The function str(s, p, e) returns the portion of s which starts at s [ p ] and is of length e. The result is type string, and may be used as a string expression. It is an error if strlen(s) is less than p + (e -1). Example VAR i: integer; wish_list: string[132]; granted: string[5]; BEGIN .
writeln (strlen(ars):2,strlen(vita):2); END. Output: 5 6 strltrim Usage strltrim(s) Argument s A string expression. Description The function strltrim(s) returns a string consisting of s trimmed of all leading blanks. The function strrtrim trims trailing blanks. Example VAR s: string[80]; BEGIN . s:= ' abc'; s:=strltrim(s); . END. {s is now 'abc'} {strlen(s) = 3 } strmax Usage strmax(s) Argument s A string variable. Description The function strmax(s) returns the maximum length of s.
ABCDE 15 strpos Usage strpos(s1, s2) Arguments s1 A string expression. s2 A string expression. Description The function strpos(s1, s2) returns the integer index of the position of the first occurrence of s2 in s1. If s2 is not found, zero is returned. If the length of s2 is zero, the result is 1. NOTE Some HP Pascal implementations have the order of the two parameters reversed. Also, your implementation may have a compiler option that reverses the order of parameters.
Example CONST one = '1'; VAR b_num: string[12]; BEGIN . b_num:= strrpt(one,strmax(b_num)); b_num:= strrpt ('a',10); . END. { b_num is '111111111111' } { b_num is 'aaaaaaaaaa' } strrtrim Usage strrtrim(s) Argument s A string expression. Description The function strrtrim(s) returns a string consisting of s trimmed of trailing blanks. Leading blanks are stripped by the function strltrim. Example VAR s: string[80]; BEGIN . s:= 'abc . s:= strrtrim(s); . END.
PACKED ARRAY[u..v] of t; the procedure pack(a, i, z) assigns components of the unpacked array a, starting at component i, to each component of the packed array z. Because all the components of z are assigned a value, the normalized value of i must be less than or equal to the difference between the lengths of a and z + 1; for example, i -m+1 <= (n-m) - (v-u) + 1. Otherwise, it is an error when pack attempts to access a nonexistent component of a. The component types of arrays a and z must be type identical.
Description This procedure transfers data from a packed array to an unpacked array. For example, assuming that a is an ARRAY[m..n] OF t and z is a PACKED ARRAY [u..v] OF t; the procedure unpack(z,a,i) successively assigns the components of the packed array z, starting at component u, to the components of the unpacked array a, starting at a [ i ]. All the components of z are assigned.
halt(n) halt Parameter n An integer expression that may be omitted. Description This procedure terminates the execution of and what is done with the optional integer defined. For more information, see the HP or the HP Pascal/HP-UX Programmer's Guide, implementation. the program.
PROCEDURE x (p : ptrtype; n : integer); BEGIN assert(p <> nil, 80101, my_assert); assert(n >= 0, 80102); END; MPE V Migration Routines baddress Usage baddress(v) Parameters v A variable, procedure, or function. Description The function baddress(v) returns the byte address of v when v is a variable name, and the entry point when v is a procedure or function name. This variable may not be type file or a file type component of a structured variable.
baddress(p^) baddress(p^.f3) baddress(a) baddress(a[4]) baddress(pac) baddress(pac[2]) baddress(pab) baddress(pab[2]) { Legal since component type is char. } { Error. } cmpbytes Usage cmpbytes (s1, s2, l ) Parameters s1 A PAC or string variable that contains a byte string to compare. s2 A PAC or string variable that contains a byte string to compare. l A shortint or bit16 expression that indicates the number of bytes to be compared.
pac := 'aacd'; pac1 := 'abcd'; result := cmpbytes( pac,pac1,s ); writeln(result); {0} pac := 'abcd'; pac1 ;= 'aacd'; result := cmpbytes( pac,pac1,s ); writeln(result); {1} end. movebyteswhile Usage movebyteswhile (s, t, a, n, u, p) Parameter s A PAC or string variable that contains the source string to be copied. t A PAC or string variable to which the source is to be copied.
pac,pac1 : pac20 s : shortint; result : shortint; begin pac1 := apac; pac := 'thisoisoaotest56789 '; movebyteswhile( pac, pac1, true, true, true, s ); writeln (s); {20} writeln('"',pac1,'"'); {"THISOISOAOTEST56789 ") pac1 := apac; movebyteswhile( pac, pac1, #1, true, false, s ); writeln (s); {20} writeln('"',pac1,'"'); {"thisoisoaotest56789 "} pac1 := apac; movebyteswhile( pac, pac1, true, #0, false, s ); writeln (s); {15} writeln('"',pac1,'"'); {"thisoisoaotest "} end.
pac s : c,m b : : pac20; shortint; : char; boolean; begin pac := 'thisoisoaotest56789 '; c := '6'; m := ' '; b := scanuntil( pac, c, m, s ); writeln (s); {16} writeln (b); {false} b := scanuntil( pac, 'x', m, s ); writeln (s); {20} writeln (b); {true} b := scanuntil( pac, #101, ' ', s ); writeln (s); {12} writeln (b); {false} end. scanwhile Usage scanwhile (s, t1, t2, p) Parameters s A PAC or string variable that contains the source string to be scanned.
type pac20 = packed array[1..20] of char; var pac : pac20; s : shortint; c,m : char; b : boolean begin pac := 'aaaaaaaaabaaaaaaaaaa'; c := 'a'; m := 'c'; b := scanwhile( pac, c, m, s ); writeln (s); {10} writeln(b); {false} b := scanwhile( pac, 'a', m, s ); writeln (s); {10} writeln(b); {false} b := scanwhile( pac,#98 ,'a', s ); writeln (s); {1} writeln(b); {true} end. waddress Usage waddress (i) Parameters i The name of a variable, procedure, or function.
r: rec_type; p: ^rec_type; a: ARRAY [1..10] OF integer; pac: PACKED ARRAY [1..10] OF char; pab: PACKED ARRAY [1..10] OF boolean; PROCEDURE pro; BEGIN END; FUNCTION f: integer; BEGIN END; Calls waddress(n) waddress(r) waddress(r.f2) waddress(p) waddress(p^) waddress(p^.f2) waddress(a) waddress(a[4]) waddress(pac) waddress(pac[3]) waddress(pab) waddress(pab[3]) waddress(pro) waddress(f) { Legal since component type is char. } { Error.
x A numeric expression. Description The arctan function returns the principal value of the angle that has the tangent equal to the argument. The result is in radians within the range -pi/2..pi/2. This function returns a real for sub-integer, integer, or real arguments, and longreal for longreal or super-integer arguments. The value used for pi is implementation dependent. Example Input Result arctan(num_exp) arctan(2) arctan(-4.002) 1.107149E+00 -1.
ln Usage ln(x) Argument x Any positive numeric expression. Description The ln function returns the natural logarithm (base e) This function returns a real for sub-integer, integer, and longreal for longreal or super-integer arguments. x is 0 or less than 0. The value used for Naperian e dependent. of or It is the argument. real arguments, is an error if implementation Example Input Result ln(43) ln(2.121) ln(0) 3.761200E+00 7.518877E-01 { error } sin Usage sin(x) Argument x A numeric expression.
Example Input Result sqr(3) sqr(1.198E3) sqr(-5) sqr(maxint) 9 1.435204E+06. 25 { error } sqrt Usage sqrt(x) Argument x Any positive numeric expression. Description The sqrt function computes the square root of its argument, which must be an expression with a numeric type. It is an error if the argument is less than 0. This function returns a real for sub-integer, integer, or real arguments, and longreal for longreal or super-integer arguments. Example Input Result sqrt(64) sqrt(13.
Numeric Conversion Functions binary, hex, and octal are the three numeric conversion functions supported in HP Pascal. binary, hex, and octal return an integer value. Therefore, all bits must be specified if a negative result is desired. Alternatively, the positive representation may be negated. A description of each of these functions follows. binary Usage binary(s) Argument s Any string or PAC expression whose range is implementation dependent.
Example Input Result hex(strng) hex('FF') -hex('FF') NOTE depends on the value of strng 255 -255 If a particular implementation uses 32-bit 2's complement notation, the following example also works: hex('FFFFFF01') = -255 octal Usage octal(s) Argument s Any string or PAC expression whose range is implementation dependent. Description The octal function converts a string or PAC expression that is interpreted as an octal value to an integer. Leading and trailing blanks in the argument are ignored.
Description The round function returns the argument rounded to the nearest integer. If x is positive or zero, then round (x ) is equivalent to trunc(x + 0.5); otherwise, round (x ) is equivalent to trunc(x - 0.5). It is an error if the result is greater than maxint or less than minint. Example Input Result round(3.1+2.4) round(3.1) round(-6.4) round(-4.6) round(1.5) 6 3 -6 -5 2 trunc Usage trunc(x) Argument x Any real or longreal expression.
Example Input Result chr(x) chr(63) chr(82) chr(13) depends on the value of x '?' 'R' (carriage return) ord Usage ord(x) Argument x An ordinal expression. Description The function ord(x) returns the integer representing the ordinal associated with the value of x. If x is an integer, x itself is returned. If x is type char, the result is an integer value between 0 and 255 determined by the ASCII order sequence.
Description The pred function returns the value whose ordinal number is one less than the ordinal number of the argument. The type of the result is identical to the type of the argument. pred(x ) must exist. Example Input Result pred(ord_var) pred(1) pred(-5) pred('B') pred(true) pred(false) depends on the value of ord_var 0 -6 'A' false {error} succ succ(x) Argument x Any ordinal expression.
Chapter 10 Input and Output Files are the means by which a program receives input and produces output. A file is a sequence of components of the same type. This may be any type except a file type or a structured type with a file type component. Logical files are files declared in a Pascal program. Physical files files that exist independently of a program and are controlled by the operating system. Logical and physical files are associated so that a program manipulates data objects external to itself.
Table 10-1. File Procedures and Functions ----------------------------------------------------------------------------------------------| | | | | Procedure or | Action | Permissible Files | | Function | | | | | | | ----------------------------------------------------------------------------------------------| | | | | append | Opens file in output state. Current position is | any | | | after last component and eof is true.
Table 10-1. File Procedures and Functions (cont.)---------------------------------------------------------------------------------------------| | | | | position | Returns integer indicating the current component of | any file except a | | | a non-text file.
I/O Standard Procedures and Functions append Usage append(f) append(f, s) append(f, s, t) Parameters f A variable of type file. The parameter f may not be omitted. s The name of a physical file associated with f. This can be a string or PAC expression whose range is implementation defined. t A string or PAC expression whose value is implementation dependent. Refer to the HP Pascal/iX Programmer's Guide or the HP Pascal/HP-UX Programmer's Guide, depending on your implementation, for more information.
associate Usage associate(f, num, option_str) Parameters f A variable of type file. num The system-provided file number of a previously opened file. option_str Must be one of the following: READ associate to sequential access file with read access. WRITE associate to sequential access file with write access. READ, DIRECT associate to direct access file with read access. WRITE, DIRECT associate to direct access file with write access.
close Usage close(f) close(f, t) Parameters f t A variable of type file. f may not be omitted. Options string that may be a string or PAC expression whose value is implementation dependent. Refer to the HP Pascal/iX Programmer's Guide or the HP Pascal/HP-UX Programmer's Guide, depending on your implementation, for more information. Description The procedure close(f) closes the file f so that it is no longer accessible.
Normally a file is closed upon exit from the block in which it is declared. A file that has been disassociated will not be closed upon exit, and must be explicitly closed with a direct call to the operating system routines. The disassociate procedure is useful when a file is passed to a Pascal routine and must remain open when control returns to the routine that passed the procedure to Pascal. Example disassociate (file_var) eof Usage eof(f) eof Parameter f A variable of type file that must be open.
Parameter f A variable of type file opened in input or direct access state. is omitted, the system uses the standard file input. If f Description The procedure get(f) advances the current file position and causes a subsequent reference to the buffer variable f^ to actually load the buffer with the current component. This definition of get is known as the deferred get. It is an error if f the call to get.
. lastpos Usage lastpos(f) Parameter f A variable of type file opened in the direct access state. be specified. f must Description The function lastpos(f) returns the integer index of the last component of f that has been accessed while the program has been running, or in the life of the file. It is an error if f is not opened as a direct access file.
Parameter f A file variable that must be opened in the direct access state where may not be omitted. f Description The function maxpos(f) returns the integer index of the last component of f that the program could possibly access. An error occurs if f is not opened as a direct access file. Note that the value returned is implementation defined. On implementations that allow direct access files to be extended, maxpos returns the value of maxint or the maximum possible number.
perform both input and output, we call open: overprint Usage overprint(f) overprint(f, e) overprint(f, e1, ..., en) overprint overprint(e) overprint(e1, ..., en) Parameters f A textfile variable that must be opened. system uses the standard file output. If f e An expression of simple, string, or PAC type, or a string literal. The system writes the value of e on f according to the formatting conventions described for the procedure write.
page Usage page(f) page Parameter f A textfile variable that must be open. uses the standard file output. If f is omitted, the system Description The procedure page(f) writes a special character to the text file f, which causes the printer to skip to the top of the form when f is printed. The current position in f advances, and the buffer variable f^ is undefined. Example page(text_file) page position Usage position(f) Parameter f A file variable that must not be a textfile.
prompt is normally used when directing output to a terminal. prompt causes the cursor to remain on the same line after output to the screen is complete. The user may then respond with input on the same line. The expression parameter, e, behaves exactly like the equivalent parameters in the procedure write. Example prompt(file_var) prompt(file_var,exp) prompt(file_var,exp1,...,expn) prompt(exp) prompt(exp1,...
read Usage read(f,v) read(f, v1, ..., vn) read(v) read(v1, ..., vn) Parameters f A file variable opened in the input or direct access state. omitted, the system uses the standard file input. If f v The name of a variable or component of a structure whose type is not FILE and does not contain a component of type FILE.
For example, the call read(f,v1,...,vn); establishes a reference, ff, to the file variable, f. to: It is equivalent read(ff,v1); read(ff,v2); . . . read(ff,vn); Example read(file_var,variable) read(file,variable1,...,variablen) read(variable) read(variable1,...,variablen) Illustration Suppose examp_file is a file of char opened in the input state. The current position is at the second component. To read the value of this component into char_var, we call read: Implicit Data Conversion.
faulty sequence of characters, or if the value is outside the range of v. After read, a subsequent reference to the buffer variable f ^ actually loads the buffer with the character immediately following the number previously read. Also note that eof is false if a file has more blanks or line markers, even though it contains no more numeric values. If v is a variable of type string or PAC, then read(f, v ) fills v with characters from f up to the number of elements of v.
---------------------------------------------------------------------------------------------| | | | | (space)Pas(end-of-line)cal | PAC {length 9} | '_Pas_____' | | | | | ---------------------------------------------------------------------------------------------| | | | | (end-of-line)Pascal | PAC {length 5} | '_____' | | | | | ---------------------------------------------------------------------------------------------| | | | | (space)Monday(space) | enumerated | MONDAY | | | | | -------------------------
readln Usage readln(f) readln(f, v) readln(f, v1, ..., vn) readln readln(v) readln(v1, ..., vn) Parameters f A textfile variable. is omitted. The system uses the standard file input if f v The name of a variable or component of a structure whose type is not FILE and does not contain a component of type FILE. Description The procedure readln(f) reads zero or more values from a textfile and then advances the current position to the beginning of the next line.
reset Usage reset(f) reset(f, s) reset(f, s, t) Parameters f A file variable that may not be omitted. s The name of a physical file that the system associates with f. may be a string or PAC expression. s t An options string that may be a string or PAC expression whose value is implementation dependent. Description The procedure reset(f) opens the file f in the input state and places the current position at the first component. The contents of f, if any, are undisturbed.
rewrite Usage rewrite(f) rewrite(f, s) rewrite(f, s, t) Parameters f A file variable that may not be omitted. s The name of a physical file the system associates with f. t May be a string or PAC expression whose value is implementation dependent. Description The procedure rewrite(f) opens the file f in the output state and places the current position at the first component. The system discards any previously existing components of f.
seek Usage seek(f, k) Parameters f A file variable that must be opened in the direct access state. may not be a textfile. k The integer index of a component of f. expression >0. It This must be an integer Description The procedure seek(f, k) places the current position of f at component k. If k is greater than the index of the highest-indexed component ever written to f, the function eof(f) returns true, otherwise false. The buffer variable f ^ is undefined following the call to seek.
Parameters f A file variable that must be open in the output or direct access state. e A variable or expression whose type is not FILE and which does not contain a component of type FILE. Description The procedure write(f, e) assigns the value of e to the current component of f and then advances the current position. After the call to write, the buffer variable f ^ is undefined. It is an error if f is not open in the output or direct access state.
Formatting of Output to Textfiles When f is a textfile, the result type of e need not be char. It may be any simple, string, or PAC type, or a string literal. The value of e may be formatted as it is written to f using the integer field-width parameters m and, for real or longreal values, n. If m and n are omitted, the system uses default formatting values.
| | | | string literal | length of string literal | | | | --------------------------------------------------------------------------- * If $STANDARD_LEVEL$ is not ANSI or ISO, then the default width of TRUE is 4. NOTE If e is Boolean or an enumerated type, the case of the letters written is implementation defined. When m is specified and the value of e requires less than m characters for its representation, the operation writes e on f preceded by an appropriate number of blanks.
11.0 11 1.9111099243164L+01 TRUE TR MAYBE writedir Usage writedir(f, k, e) writedir(f, k, e1, ..., en) Parameter f A file variable opened in direct access state. k The integer index of a component of f. e An expression whose result type must be assignment compatible with the components of f. Description The procedure writedir(f, k, e) places the current position at the component of f specified by k, and then writes the value of e to that component.
writeln Usage writeln(f) writeln(f, e) writeln(f, e1, ..., en) writeln writeln(e) writeln(e1, ..., en) Parameters f A file variable for a text file opened in the output state. system uses the standard file output if f is omitted. e A variable or expression whose type is not FILE and does not contain a component of type FILE.
writeln(fil_var,exp1,...,expn) writeln(exp) writeln(exp1,...
10- 28
Chapter 11 System Programming Extensions This chapter describes extensions to HP Pascal for systems programming. The following subjects are covered: * * * * * * * pointers type coercion error handling parameter mechanisms crunched packing routine mechanisms predefined routine Some HP implementations of Pascal do not support all of these features.
Figure 11-1. Relationship of STANDARD_LEVEL Compiler Option Parameters The STANDARD_LEVEL compiler option allows the user to choose one of five options which specifies what features or extensions are to be allowed in a given program. The five options correspond to sets which have the relationship depicted in Figure 11-1 above. If a STANDARD_LEVEL option is not specified, the default feature set is HP_PASCAL.
CHECK_FORMAL_PARM CODE CODE_OFFSETS CONVERT_MPE_NAMES COPYRIGHT COPYRIGHT_DATE ELSE ENDIF EXEC_PRIVILEGE * EXTERNAL EXTNADDR FONT * GLOBAL GPROF ** HEAP_COMPACT HEAP_DISPOSE HP3000_16 * HP3000_32 * * LIST_CODE LISTINTR LITERAL_ALIAS LOCALITY MAPINFO LONG_CALLS MLIBRARY * ** NLS_SOURCE * ** NOTES OPTIMIZE OS OVFLCHECK PAGE * PAGEWIDTH PARTIAL_EVAL * POP PUSH RANGE * ** ** STANDARD_LEVEL * STATEMENT_NUMBER * STDPASCAL_WARN STRINGTEMPLIMIT SUBPROGRAM SYMDEBUG * ** SYSINTR * ** SYSPROG TABLES TITLE TYPE_COE
* Types: anyptr bit16 bit32 bit52 globalanyptr localanyptr longint longreal* shortint string* HP_MODCAL * ANYVAR parameters. * Compiler Options: TYPE_COERCION (MPE/iX,HP-UX) * Error handling with: escape escapecode TRY-RECOVER * Procedure and Function Types and Variables. * Special Predefined Routines: addr call fcall statement_number EXT_MODCAL * CRUNCHED packing.
are not reserved and can be defined by the user. Predefined Identifiers The system programming extensions add the following identifiers to the HP Pascal list of predefined identifiers. The compiler issues warning messages if it encounters these identifiers and the standard level is too low. Like any predefined identifiers, these identifiers may be redefined by the user. Table 11-2.
| | | | move_l_to_r | Predefined move procedure | | | | ------------------------------------------------| | | | move_r_to_l | Predefined move procedure | | | | ------------------------------------------------| | | | sizeof | Predefined size function | | | | ------------------------------------------------- Data Types Figure 11-2 summarizes the types that are supplied by the system programming extensions. A detailed discussion of the data types follows in this chapter.
the start of a structured type declaration. The system programming extensions define a third type of packing in addition to unpacked and packed, namely CRUNCHED. The reserved word CRUNCHED indicates that the components of a structured type (array, record, or set) are allocated contiguously, first to last, in a bit-aligned fashion with no intervening unused bits. Syntactically, the word CRUNCHED may be substituted for the word PACKED.
Figure 11-4. Layout of a Crunched Record Note that there are no wasted bits between fields in the crunched record. The number of bits used to represent each component of a crunched structured type is the minimum needed to represent the values associated with that component. The calculation of the minimum number of bits for various types is: * Record, Array Types. The sum of the minimum number of bits required to represent each component.
Table 11-3. Number of Bits Allocated for Unsigned Subranges ----------------------------------------------------------------------------------------------| | | | | Lower Bound Range | Upper Bound Range | # Bits Allocated | | | | | ----------------------------------------------------------------------------------------------| | | | | >= 0 | 0..1 | 1 | | >= 0 | 2..3 | 2 | | >= 0 | 4..7 | 3 | | >= 0 | 8..15 | 4 | | >= 0 | 16..31 | 5 | | >= 0 | 32..63 | 6 | | >= 0 | 64..127 | 7 | | >= 0 | 128..
| -134217728..-67108865 | 67108864..134217727 | 28 | | -268435456..-134217729 | 134217728..268435455 | 29 | | -536870912..-268435457 | 268435456..536870911 | 30 | | -1073741824..-536870913 | 536870912..1073741823 | 31 | | -2147483648..-1073741825 | 1073741824..2147483647 | 32 | | | | | ---------------------------------------------------------------------------------------------- Example TYPE cr1_t = CRUNCHED RECORD f1 : 0..15; f2 : -1..15; f3 : -16..15; f4 : 13..
and long pointers. Long pointers can point to any addressable object on the system (in this sense addressable in terms of the representability of an address, as opposed to allowed access rights). Short pointers can point to a subset of the objects addressable by long pointers. A subset of the object addressable by short pointers are objects in the heap. By default, all user declared pointers are short pointers. The following diagram explains the relationship between these classes of pointers.
anyp := ptr2; ... ptr1 := anyp; ... END; Globalanyptr. The predefined type globalanyptr is a pointer type that is assignment compatible with any other pointer type. It can be used to defeat type checking on pointers. A pointer of any type can be assigned to a pointer of type globalanyptr, and a pointer of type globalanyptr can be assigned to any pointer type. However, since pointers of type globalanyptr are not bound to a base type, they cannot be dereferenced.
BEGIN ... anyp := ptr1; anyp := ptr2; ... ptr1 := anyp; ... END; The above example illustrates that a variable of type anyptr is assignment compatible with any other pointer type. Example VAR ptr1 ptr2 : pointer_type_1; : pointer_type_2; PROCEDURE proc( ptr : anyptr ); BEGIN ... END; BEGIN proc( ptr1 ); proc( ptr2 ); END; In the above example, the routine proc can accept any pointer as an actual parameter because the type of the formal parameter is anyptr.
A parallel can be drawn between pointers and PROCEDURE/FUNCTION variables. While pointers are variables that reference data, PROCEDURE/FUNCTION variables reference code. Variables of PROCEDURE/FUNCTION types may be assigned procedures and functions that have congruent parameter lists, as defined in HP Pascal. See chapter 8 for more information on parameters. To assign a procedure or function to a PROCEDURE/FUNCTION variable, the routine name is used as a parameter to the addr function.
func_2 := nil; proc_0 proc_1 proc_1 func_0 END. := := := := addr( addr( addr( addr( { initialized to nil } p1 p2 p3 p1 ); ); ); ); { { { { proc_0 now 'points to' p1 } illegal: parameters don't match } illegal: parameters don't match } illegal: must be a function } Example TYPE proc_type = PROCEDURE; VAR proc_var_0 : proc_type; PROCEDURE proc_1; VAR proc_var_1 : proc_type; PROCEDURE proc_2; BEGIN {PROCEDURE proc_2} ...
Syntactically, value type coercion is allowed: * In an expression. * On the right-hand side of an assignment statement. * On an actual parameter. By default, the compiler does not allow value type coercion. The compiler option TYPE_COERCION allows the user to enable a certain level of type coercion. There are three classes of type coercion based on the source and target types: ordinal, pointer, and free union type coercion.
information that a long pointer requires. Coercion from a long to a short pointer, in implementations where long pointers point to a wider class of objects than short pointers, may involve truncating the value of the long pointer. If this occurs, the short pointer may not be able to address the original object pointed to by the long pointer because of the short pointer's limited addressing. This is an error. If range checking is on, this causes a run-time error.
Structural. A type coercion expression is considered to be structural the following are true: * The bitsizes of the source and target types are the same. * The alignment of the source and target types are the same. * The source and target types are compatible. * If the source and target are structured, then the corresponding component in the two structures obey the above three rules of bitsizes, alignment and compatibility.
$PUSH, TYPE_COERCION 'REPRESENTATION'$ WRITE( hex_digit[ nibble_array( n )[i] ] ); $POP$ END; In the above example, the integer n is treated as an array of nibbles in order to extract each nibble sequentially and write out its value in hexadecimal. Since representation type coercion guarantees that the source and target types are identical in size, the compiler can guarantee that the entire integer is covered by the nibble array: there are no bits missed. Storage.
non_protected_space := idx - 1; END; The previous example coerces an integer to an array of integers and keeps accessing farther out into the array until it cannot access any further. Note that this code assumes that: * TRY-RECOVER traps the error condition that occurs when the array access grows beyond the limits of the available space. * The value of the variable idx is updated correctly when execution is transferred to the RECOVER statement. Declaration Section Constant Definition NIL.
* The run-time environment is restored to the environment of the most recent TRY-RECOVER statement. This may involve prematurely exiting any nested procedure and function calls and closing any open files local to those routines. * Execution is transferred to the statement following the reserved word RECOVER. If no errors are detected within the body of the TRY-RECOVER statement, the recover statement is skipped, and execution continues at the first statement following the TRY-RECOVER statement.
END. In the previous example, any errors occurring in the TRY-RECOVER in proc1 cause execution to be transferred to the recover part of the try statement in proc1. Any errors occurring in the TRY-RECOVER in the outer block, in the recover statement in proc1, and outside of the TRY-RECOVER in proc1 cause execution to be transferred to the recover part of the try statement in the outer block.
through the use of the predefined functions sizeof and bitsizeof. additional size parameter is not passed when the routine option UNCHECKABLE_ANYVAR is used. This This implicit reference type coercion is independent of the level of type coercion selected when the actual parameter is used. Example TYPE byte = 0..255; byte_array = PACKED ARRAY [1..max_bound] OF byte; VAR int : integer; rec : record_type; PROCEDURE zero_bytes( ANYVAR arr : byte_array ); VAR i : 0..max_bound; limit : 1..
The above example creates detected errors. NOTE The mechanism does not detect a modification of a READONLY parameter by another reference parameter or an uplevel reference. The results of such a modification are unpredictable.
For forward and external declarations of routines, the options specified on the forward or external routine declaration must match the options on the formal declaration. DEFAULT_PARMS. Normally, all parameters appearing in a formal parameter list must be present in every corresponding actual parameter list. The routine option DEFAULT_PARMS allows parameters to be omitted from the actual parameter list.
Syntax Note that if a particular extension parameter is supplied in an actual parameter list, then all EXTENSIBLE (and non-defaulted) parameters to the left of the supplied parameter must also be supplied. It is an error to access a formal parameter whose corresponding actual parameter was not passed. An EXTENSIBLE parameter list, therefore, is always passed with a hidden parameter describing the number of parameters actually passed.
Example PROCEDURE proc( x,y : integer ) OPTION INLINE; ... BEGIN ... END; For more information about INLINE, refer to the HP Pascal/iX Programmer's Guide or the HP Pascal/HP-UX Programmer's Guide, depending on your implementation. UNCHECKABLE_ANYVAR. By default, every ANYVAR parameter is accompanied by a hidden size parameter that indicates the size of the actual parameter.
returned if it cannot. This procedure option can be specified only on level one procedures or functions. NOTE On implementations that do not support dynamic loading, taking the address of an unresolved routine always produces NIL, while calling an unresolved routine is an error. A procedure or function declared with option UNRESOLVED must not have a body, and must be declared with the directive EXTERNAL. Syntax Example PROCEDURE product_x OPTION UNRESOLVED; external; BEGIN ...
offset A signed integer expression. routine-name The name of a procedure or function. Description The predefined function addr returns a pointer value that is the address of the argument. The type of the pointer returned by addr is assignment compatible with any pointer type. Addr returns a short or long pointer depending on the context in which it is called, the context being the type of the target variable of an assignment, the type of a formal parameter, or the target type of a type coercion.
is implementation dependent. Description Addtopointer returns a pointer value that points delta bytes away from where the argument pointer pointed. The type of the pointer returned by addtopointer is the same as the type of the parameter pointer. The results of an overflow are implementation dependent. Example TYPE intptr = ^integer; VAR ptr1: intptr; ptr2: intptr; i: integer; BEGIN ptr2 := addtopointer (ptr1, i); ptr1 := addtopointer (ptr1, sizeof(integer)); END Buildpointer.
offset of zero in the space whose space id is Global_Known_Space. The second use of buildpointer creates a pointer to the location four bytes from the beginning of the space whose space has been assigned to the variable SID. Move Routines The system programming extensions provide the predefined procedures move_l_to_r, move_r_to_l, fast_fill, and move_fast for generalized and efficient data copying. Move_L_to_R. The predefined procedure move_l_to_r provides a generalized array copying mechanism.
Figure 11-6. Copying Order for move_l_to_r Example TYPE Index_Type_1 = 0..20; Index_Type_2 = -3..
mechanism. Usage move_r_to_l(count,source,source_index,target,target_index) Parameters count source source_index target target_index A positive integer expression whose value is the number of elements to move. The source array from where elements will be moved. An integer expression whose value is the index into the source array from where the move will begin.
Figure 11-7. Copying Order for move_r_to_l Fast_Fill. The predefined procedure fast_fill provides a generalized method of initializing an array to a single 8 bit constant. Usage fast_fill (ptr,fill_char,count); Parameters ptr A pointer expression. fill_char A constant expression. count A positive integer expression that contains the number of bytes to fill with fill_char.
{with fast_fill(addr(i1000),0,sizeof(i1000)); {fill {with new(p); fast_fill(p,hex('ff'),sizeof(p^)); {fill {heap end. spaces.} an integer array} 0s. } an array in the } to -1 (all bits on).} Move_Fast. The predefined procedure move_fast provides another generalized array copying mechanism. Usage move_fast(count,source,source_index,target,target_index) Parameters count A positive integer expression whose value is the number of elements to move. source The source array from where elements will be moved.
byte boundaries, and the total size of the elements to be moved must be an integral multiple of one byte. Example { This example assumes certain packing which may not apply to your implementation. } TYPE IxType1 = 0..20; IxType2 = -3..17; Array1 Array2 Array3 Array4 = = = = PACKED ARRAY [IxType1] of SHORTINT; ARRAY [IxType2] of SHORTINT; PACKED ARRAY [1..20] of -256..255; CRUNCHED ARRAY [1..20] of -256..
The parameter is evaluated before control is passed and, its value is available to the escapecode function. If escape is called with no surrounding TRY-RECOVER the program aborts. Example PROCEDURE proc; ... BEGIN ... IF ( {something has gone wrong} ) THEN ESCAPE( 0 ); ... END; ... BEGIN TRY ... proc; ... RECOVER WRITELN( 'fatal error. program terminates' ); END. Escapecode. The predefined function escapecode returns the last execution error number.
The example above shows a possible control structure for trapping software errors. Within the recover section of the TRY-RECOVER statement, escapecode is used to recover information about the nature of the error that caused the trap to the recover section. Note the use of escapecode to pass certain errors on to a next enclosing TRY statement with an explicit call to escape. Parameter Mechanisms Haveextension. The predefined Boolean function haveextension determines if an extension parameter is accessible.
parm3 : type3; VAR parm4 : type4 ) OPTION EXTENSIBLE 2 DEFAULT_PARMS ( parm3 := 0, parm4 := nil ); BEGIN ... IF (haveextension( parm3 )) THEN ... IF (haveextension( parm4 )) THEN ... ... END; In the above example, haveextension( parm4 ) returns true only if the fourth parameter was actually supplied by the user. If it was not supplied, then the default value is ignored, and the parameter is not passed.
... IF (haveoptvarparm( parm2 )) THEN ... IF (haveoptvarparm( parm3 )) THEN ... END; { ok to use parm2 } { ok to use parm3 } The procedure proc_with_opt_parms in the previous example has three VAR parameters, two of which are optional. Before using one of the two parameters within proc_with_opt_parms, a check is made to ensure that the parameters were supplied by the user. This check is accomplished by calling haveoptvarparm with the name of the parameter in question as its argument.
END; In the above example, the two calls to the routine proc are effectively identical. Fcall. The predefined function fcall invokes a function. Usage fcall(function_expression) fcall( function_expression, parameter ... ) Parameters function_expression An expression whose value is a reference to a function whose formal parameter list is congruent with the parameters specified in the call.
The bitsizeof function returns the number of bits needed to represent the data value part of a data item of the given type, or the actual allocated size of a variable. If the first parameter is a record type or variable with variants, a variant may be selected by specifying a case constant with the subsequent parameters. Otherwise, the size with the largest variant is used.
tag_value The name of a case constant in the variant part of a record declaration. Case constants for nested variants may appear separated by commas. type_name The name of a type. record_type_name The name of a record type with variants. struct_constant string_literal The name of an array, record, set, or string constructor. A string literal.
11- 44
Chapter 12 Compiler Options Introduction This chapter explains every HP Pascal compiler option. Compiler options fall into two categories: system-independent and system-dependent. System-independent options work the same way whether HP Pascal is running on the MPE/iX operating system or the HP-UX operating system. System-dependent options either work on only one operating system, or they work differently on HP-UX and MPE/iX. The following table categorizes the compiler options.
Table 12-1. Compiler Option Locations and Scopes --------------------------------------------------------------------------------------| | | | | Location Term | Option Location | Option Scope | | | | | --------------------------------------------------------------------------------------| | | | | Anywhere. | Anywhere in the program. | Depends upon the option. | | | | | --------------------------------------------------------------------------------------| | | | | At front.
HP Pascal (with and without system programming extensions). Figure 12-1. Relationship Between HP Pascal and ANSI Standard Pascal The following table categorizes the system-independent compiler options.
NOTE File name parameters have different syntax on the HP-UX and MPE/iX operating systems. See the HP Pascal/iX Programmer's Guide or the HP Pascal/HP-UX Programmer's Guide. HP Standard Options HP Standard compiler options are available on all versions of Pascal that run on HP computers. They are part of the HP Standard. An HP Pascal program containing only HP Standard options can be compiled by any Pascal compiler that runs on an HP computer.
MPE/iX Options MPE/iX compiler options are available only in HP Pascal running on the MPE/iX operating system.[REV BEG] See the $OS compiler option later in this chapter.[REV END] HP-UX Options HP-UX compiler options are available only in HP Pascal running on the HP-UX operating system.[REV BEG] See the $OS compiler option later in this chapter.
between uppercase and lowercase letters. By default, the external name is downshifted. The LITERAL_ALIAS compiler option allows the external name to remain as it is. The UPPERCASE compiler option upshifts the external name. Default The internal name, downshifted (or upshifted if UPPERCASE is ON). Location Routine: Global variable: Heading. Immediately after the variable name in the variable declaration.
. . END; {do_it} BEGIN {proc1} . . END; {proc1} PROCEDURE proc2; FUNCTION $ALIAS 'D2'$ do_it (a,b : INTEGER): INTEGER; BEGIN {do_it} . . END; {do_it} BEGIN {proc2} . . END; {proc2} BEGIN {show_alias} . . END. {show_alias} Example 3 PROGRAM show_alias; FUNCTION $ALIAS 'f'$ f1 (p1 : integer); EXTERNAL; FUNCTION $ALIAS 'f'$ f2 (p1,p2 : integer); EXTERNAL; BEGIN . . . END. Notice that the function f1 declares one parameter of the function f, while the function f2 declares two.
Default Depends upon packing algorithm. Location After the symbol = in a type definition. Example TYPE Rec = $ALIGNMENT 16$ RECORD F1 : Integer; F2 : ShortInt; F3 : Real; END; Integer_ = $ALIGNMENT 2$ Integer; Ptr = ^Integer_; ANSI ANSI is an HP Standard When the ANSI compiler whenever it encounters ANSI Standard Pascal. possible; otherwise it listing. Option.
0 0 0 4.000 5.000 6.000 0 0 0 BEGIN assert(false,0); ^ **** ERROR # 1 THIS FEATURE REQUIRES $STANDARD_LEVEL "HP_PASCAL" (539) 1 7.000 0 END. ARG_RELOCATION ARG_RELOCATION is an HP Pascal Option. The ARG_RELOCATION option can be used to suppress parameter relocation information for all procedure or function definitions and calls. This option is only useful for REAL and LONGREAL data types.
Refer to the Procedure Calling Conventions Reference for detailed information on how to use this option. occur. Manual ASSERT_HALT ASSERT_HALT is an HP Pascal Option. The ASSERT_HALT compiler option works with the predefined function assert. IF an assert fails (that is, if its Boolean expression is false), and ASSERT_HALT is ON, the program terminates. If ASSERT_HALT is OFF, the program continues to execute. See the HP Pascal/iX Programmer's Guide or the HP Pascal/HP-UX Programmer's Guide.
NOTHING The optimizer assumes nothing, overriding any previous assumptions. PASCAL_FEATURES The optimizer assumes that routines are defined and called with Pascal features only. PASCAL_FEATURES implies PASCAL_POINTERS, PARM_TYPES_MATCH, NO_PARM_ADDRESSED, and LOCAL_ESCAPES_ONLY. PASCAL_POINTERS The optimizer assumes that no operation except the function new creates a pointer, and no operation except an assignment statement modifies its value.
invariant expressions (that are conditioned by an IF) out of loops. This parameter can be used in conjunction with any of the other parameters. Refer to the +FP compiler option in the HP Pascal/iX Programmer's Guide or the HP Pascal/HP-UX Programmer's Guide, depending on your implementation, as well as the PA-RISC 1.1 Architecture and Instruction Set Reference Manual. Default NOTHING (assuming that FLOAT_TRAPS_ON is not specified).
After compiling a routine, the compiler knows what it accesses and modifies, so the optimizer can derive the appropriate assumptions. Only exported, forward, and external routines require that you specify LOCAL_GOTOS_ONLY, LOCAL_ACCESSES_ONLY, NO_SIDE_EFFECTS, or NO_HEAP_CHANGES. These assumptions are valid for intrinsic functions and procedures, but you must specify them in the routine.
END ; {nested} $POP$ BEGIN {intnl} { Optimizer assumes: { PASCAL_POINTERS (inherited) { PARM_TYPES_MATCH (inherited) { LOCAL_GOTOS_ONLY (specified) { NO_SIDE_EFFECTS (known after compilation) } nested ; END ; {intnl} $POP$ BEGIN { main program } { Optimizer assumes: { PASCAL_POINTERS (implied) { PARM_TYPES_MATCH (implied) } intnl ; 999: END . Example 2 The following example turns on the IEEE floating-point traps. (On HP-UX, the +FPZ option can be used instead of the call to HPENBLTRAP).
Syntax $BUILDINT [string ]$ Parameter string Specifies the name of the intrinsic file that the compiler builds. If the specified file exists and is an intrinsic file, entries are added to it. If it exists, but is not an intrinsic file, it is an error. If the file does not exist, it is created (see the HP Pascal/iX Programmer's Guide or the HP Pascal/HP-UX Programmer's Guide ). Default System intrinsic file. Location At front.
CALL_PRIVILEGE and EXEC_PRIVILEGE CALL_PRIVILEGE and EXEC_PRIVILEGE are System-Dependent MPE/iX Options. The CALL_PRIVILEGE and EXEC_PRIVILEGE compiler options allow routines to call and execute privileged mode routines. To use these compiler options, the option STANDARD_LEVEL 'EXT_MODCAL' is required. The CALL_PRIVILEGE option specifies, for a given routine, the minimum privilege level that other routines must have to call the specified routine.
any level. Procedure proc3 executes at privilege level 0; any routine calling proc3 must be executing at level 1 or higher. CHECK_ACTUAL_PARM CHECK_ACTUAL_PARM is an HP Pascal Option. The CHECK_ACTUAL_PARM compiler option determines how closely the actual parameters of routines must match their formal parameters in separately compiled sources. If the actual and formal parameters are incompatible, the linker does not link the program. Syntax $CHECK_ACTUAL_PARM integer $ Parameter integer In the range 0..
0 0 2 0 0 0 0 0 4 4 4 5 5 5 6 6 6 6 6 15.000 16.000 17.000 18.000 19.000 20.000 21.000 22.000 23.000 24.000 24.000 25.000 26.000 27.000 28.000 29.000 30.000 31.000 32.000 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 PROCEDURE $ALIAS 'proc'$ proc_c (cp : char_ptr_type); EXTERNAL; {Renaming the procedure gets around HP Pascal's} {parameter type checking} BEGIN proc(int_ptr); $CHECK_ACTUAL_PARM 2$ proc_c(char_ptr); {Using CHECK_ACTUAL_PARM gets around the linker's} {parameter type checking} END.
The compiler does not generate type-checking code for intrinsic routines. (An intrinsic routine is identified as such with the INTRINSIC directive. See the HP Pascal/iX Programmer's Guide or the HP Pascal/HP-UX Programmer's Guide.) Example PAGE 1 HEWLETT-PACKARD 0 0 0 0 0 0 0 0 0 0 0 0 2 3 4 5 6 7 8 8 8 0 0 1.000 2.000 3.000 4.000 5.000 6.000 7.000 8.000 9.000 10.000 11.000 12.000 13.000 14.000 15.000 16.000 17.000 18.000 19.000 20.000 21.000 22.000 23.000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 1 .
BEGIN : $CODE OFF$ : END; $CODE ON$ BEGIN : END. CODE_OFFSETS CODE_OFFSETS is an HP Pascal Option. When the CODE_OFFSETS compiler option is ON (and the LIST compiler option is ON), the compiler prints a table that contains the statement number and offset of each executable statement that it lists. Syntax $CODE_OFFSETS {ON }$ {OFF} Default OFF Location Anywhere. The offset is the address of the first machine instruction generated for the statement, relative to the start of the routine or outer block.
Example PROCEDURE outer; PROCEDURE inner; BEGIN . . . END; BEGIN . . . END; C O D E O F F S E T S outer$4$inner STMT 1 OFFSET 20 STMT 2 OFFSET 30 outer STMT 1 OFFSET 10 STMT 2 OFFSET 2C Outer$4$inner is the procedure label for the level two procedure, inner, contained in the level one procedure outer. Statement one of inner is offset 20 (hexadecimal) bytes from the address of inner. NOTE This feature is intended for use with an assembly-level debugger.
converts MPE/iX-format file names to lowercase letters. For example, assume the HP-UX directory structure account/group, where group is a directory containing the file f. If a Pascal source program contains the statement $INCLUDE 'F.Group.Account'$ [REV BEG] then the compiler prefixes[REV END] the appropriate path information to f, and searches for the resulting name (for example, if the compilation is performed in the group-level directory, then the compiler includes the file ../../account/group/f).
$COPYRIGHT_DATE date_string $ Parameter date_string Specifies the date string to appear in the copyright notice, as follows: (C) Copyright date_string by string_literal. All rights reserved. No part of this program may be photocopied, reproduced, or transmitted without prior written consent of string_literal. (The COPYRIGHT option sets string_literal.) Default Current year. Location At front.
[ . [ . [ . ] ] ] $ENDIF$ In this example, the code following $ELSE is compiled because group1 is set to FALSE. Example 2 $SET 'group3=true,group2=false;group1=false'$ . . . $IF 'group1'$ [source_line ] [ . ]{group1} [ . ] [ . ] $ELSE$ $IF 'group2'$ [source_line ] [ . ]{group2} [ . ] [ . ] $ELSE$ $IF 'group3'$ [source_line ] [ . ] {group3} [ . ] [ . ] $ENDIF$ $ENDIF$ $ENDIF$ In this example, only group3 is compiled because it is set to true and group1 and group2 are set to false.
[ . [ . ] ] $ENDIF$ EXTERNAL EXTERNAL is an HP Pascal Option. The EXTERNAL compiler option causes the compiler to generate code for routines, but not for statements in the outer block. It also generates symbolic information about global variables, allowing them to be matched (by external name) to their counterparts in the compilation unit compiled with the GLOBAL compiler option. (The EXTERNAL compiler option is used in compilation units compiled with the SUBPROGRAM compiler option.
Default Location Not applicable. In a pointer type or variable declaration, between ^ or @ and the type name, or in a parameter list, between VAR, ANYVAR, or READONLY and the following parameter name.
FONT '0,5'$ $TITLE 'Dptcore. CONTROLNPort Data DefinitionsCONTROLO'$ . . . PROCEDURE Proc1; {This is the CONTROLNfirstCONTROLO procedure} . . . The listing prints the title and comment shown above this way: Dptcore. Port Data Definitions {This is the first procedure} GLOBAL GLOBAL is an HP Pascal Option.
. . END. Another compilation unit: $EXTERNAL$ PROGRAM show_external (input,output); VAR state : Boolean; {Matches variable in show_global's outer block} {a,b,c,d need not be declared here because this compilation unit does not use them.} PROCEDURE proc1; BEGIN . . . END; BEGIN {Empty outer block} END. GPROF GPROF is a System-Dependent HP-UX Option. The compiler option GPROF causes the compiler to produce code that profiles itself as it runs. You can analyze the profiles with the HP-UX utility gprof.
procedure dispose is called. Syntax $HEAP_COMPACT {ON }$ {OFF} Default OFF. Location At front. The HEAP_COMPACT option is recommended for programs that manipulate many dynamic record variables of different sizes via calls to the predefined procedures new and dispose. It allows free space to be merged and reused. Example $HEAP_COMPACT ON; HEAP_DISPOSE ON$ PROGRAM show_compact; TYPE big_rec = RECORD f1 : ARRAY [1..
BEGIN FOR i := 1 TO maxint DO BEGIN new(ptr); . . . dispose(ptr); END; END. {If HEAP_DISPOSE were OFF, the heap} {would overflow and an error would occur} HP_DESTINATION [REV BEG] HP_DESTINATION is a System-Dependent HP-UX Option. Syntax $HP_DESTINATION '{ARCHITECTURE PAmodel }'$ {SCHEDULER PAmodel } Where: ARCHITECTURE Specifies the desired destination architecture. PAmodel SCHEDULER Location 1.0 Generates object code suitable for all implementations of PA-RISC 1.0 or higher.
on your implementation.[REV END] [REV BEG] NOTE If you specify an architecture other than the native architecture of your machine, your compiled program may not run on your machine. Specifically, code compiled with HP_DESTINATION 'ARCHITECTURE PA1.1' may not run on a PA-RISC 1.0 machine. NOTE A program containing the HP_DESTINATION 'ARCHITECTURE' compiler option must be linked with the pc command line option +DAmodel. This is because +DAmodel does more than specify the destination architecture.
looks exactly like the same structure compiled by the Pascal/V compiler. This is useful for reading data files generated by Pascal/V. HP3000_16 does not affect file and pointer types. The allocation and alignment of file variables is system-dependent, and HP Pascal does not allow the creation of files that contain files. The allocation and alignment of pointers is also system dependent, so pointers are not portable. A pointer declared in an HP Pascal program can be used only with HP Pascal (not Pascal/V).
and real numbers. HP3000_32 strings, sets, and real numbers are not assignment compatible with HP3000_16 strings, sets, and real numbers. Use the predefined procedures strconvert and setconvert and the intrinsic HPFPconvert to convert HP3000_32 strings, sets, and real numbers to HP3000_16 strings, sets, and real numbers. Example $HP3000_16$ PROGRAM show_packing_algorithms; TYPE t_pac = PACKED ARRAY [1..10] OF char; s_pac = $HP3000_32$ PACKED ARRAY [1..10] OF char; t_starray = ARRAY [1..
END; VAR v_file1 v_file2 v_file3 v_file4 : : : : t_file; s_file; FILE OF t_rec; FILE OF s_rec; {error} BEGIN END. IF IF is an HP Pascal Option. The IF compiler option specifies code to be compiled conditionally, depending on the value of a Boolean expression. Syntax $IF 'Boolean_expression '$ Parameter Boolean_expression Any constant Boolean expression containing the operators AND, OR, and NOT and parentheses.
{Fragment 1} $SET 'group1=true, group2=false'$ . . . $IF 'group1 AND (NOT group2)'$ [source_line ] [ . ] [ . ] [ . ] $ENDIF$ {Fragment 2} $SET 'group1 = true'$ $SET 'group2 = false'$ . . . $IF 'group1'$ $IF 'NOT group2'$ [source_line ] [ . ] [ . ] [ . ] $ENDIF$ $ENDIF$ Example 2 $SET 'group1=FALSE'$ . . . $IF 'group1'$ [source_line ] [ . ] [ . ] [ . ] $ELSE$ [source_line ] [ . ] [ . ] [ . ] $ENDIF$ Example 3 $SET 'group3=true,group2=false;group1=false'$ . . . $IF 'group1'$ [source_line ] [ . ]{group1} [ .
[ . [ . ] ] $ELSE$ $IF 'group3'$ [source_line ] [ . ] {group3} [ . ] [ . ] $ENDIF$ $ENDIF$ $ENDIF$ INCLUDE INCLUDE is a System-Dependent MPE/iX and HP-UX Option. The INCLUDE compiler option includes text from a specified file in the source code being compiled. Syntax $INCLUDE string_literal $ Parameter string_literal Specifies the name of the file to be included at the current position in the program. The file specification depends upon the operating system. Default None. Location Anywhere.
Example 1 This example applies only to HP-UX. PROGRAM show_include; VAR $INCLUDE '/users/pascal/prog1/global'$ BEGIN i := 3; j := 1.55; END. If the file /users/pascal/prog1/global is: i : INTEGER; j : REAL; Then the preceding program is equivalent to: PROGRAM show_include; VAR i : INTEGER; j : REAL; BEGIN i := 3; j := 1.55; END. Example 2 This example applies only to MPE/iX. PROGRAM show_include; VAR $INCLUDE 'global.prog1.pascal'$ BEGIN i := 3; j := 1.55; END. If the file global.prog1.
files. The command line option -I include-search path also specifies this option. You can specify multiple paths by repeating the command line option -I for each path. syntax $INCLUDE_SEARCH '[+] [&] string [, string ]...'$ Parameter Default None. Location Anywhere. The string parameter specifies a path for the compiler to search for an included file. This path is called the include-search path.
HP-UX Example The following program is in a file called /tmp/test.p, and the current working directory is /users/myself/work. PROGRAM show_include; $INCLUDE_SEARCH '../experimental, ../official, /c/official'$ $INCLUDE 'globals'$ BEGIN END. The compiler will attempt to find the included file globals by searching successively in each location specified by the search path. In this example, the compiler will look for the files listed below in the following order. 1.
(X,Y: Integer); . . . In each compilation unit where you want to duplicate the code of a specific routine in-line, you must specify the entire routine definition. If you use the same routine in-line in more than one compilation unit, put them in a separate file and use the INCLUDE compiler option to include that file in each compilation unit.
Actually, the intrinsic search mechanism searches for the intrinsic name (other than specified by INTR_NAME) or the alias (if specified by the ALIAS compiler option), but it returns the name specified by INTR_NAME. Example $BUILDINT 'MYINTR'$ PROGRAM Show_Buildint; PROCEDURE Proc2 (p1 : Boolean; p2 : integer; p3 : real ); $ALIAS 'proc2alias'$ $INTR_NAME 'proc2returnname'$ EXTERNAL; BEGIN END. The intrinsic file search mechanism searches for proc2alias, but returns proc2returnname.
.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY PROGRAM _start .PROC .CALLINFO CALLER,FRAME=0,SAVE_SP,SAVE_RP .ENTRY STW 2,-20(0,30) ;offset 0x0 LDO 48(30),30 ;offset 0x4 STW 0,-4(0,30) ;offset 0x8 .CALL ; BL P_INIT_ARGS,2 ;offset 0xc NOP ;offset 0x10 .CALL ; BL U_INIT_TRAPS,2 ;offset 0x14 NOP ;offset 0x18 $00002711 .CALL BL P_TERMINATE,2 ;offset 0x1c NOP ;offset 0x20 NOP ;offset 0x24 .CALL BL U_EXIT,2 ;offset 0x28 NOP ;offset 0x2c LDW -68(0,30),2 ;offset 0x30 BV 0(2) ;offset 0x34 .
Default 59 Location Anywhere. Example PROGRAM show_lines (output); VAR i : shortint; BEGIN writeln('line 5'); writeln('line 6'); . . . writeln('line 58'); $LINES 20$ writeln('line 60'); writeln('line 61'); . . . writeln('line 79'); writeln('line 80'); END.
12- 44
LIST LIST is an HP Standard Option. When the LIST compiler option is ON, the compiler produces a listing of the source code. The command line option -L also specifies this option. Syntax $LIST {ON }$ {OFF} Default ON. Location Anywhere. The first column of the listing shows the source statement number. This number appears in the code offset table, is used by the symbolic debugger, and is returned by the predefined function statement_number. The second column of the listing shows a line number.
have any effect. Example PAGE 1 HEWLETT-PACKARD 0 0 0 0 0 0 1 2 ** ** ** ** 2 2 1.000 2.000 3.000 4.000 5.000 6.000 7.000 8.000 8.100 8.200 8.300 8.400 9.000 10.000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 **** ERROR # 1 3 11.000 3 12.000 4 13.000 4 14.000 4 15.000 0 0 0 0 0 **** ERROR #2 5 16.000 5 17.000 6 18.000 6 19.000 0 0 0 0 PAGE 0 1 1 2 3 3 4 4 4 4 5 6 6 6 7 8 9 9 9 10 10 0 PAGE (C) HEWLETT-PACKARD CO. 1986 ...
5 5 6 6 0 PAGE 50.000 51.000 52.000 53.000 54.000 1 1 1 0 0 close(outfile); END; $PAGE$ 4 HEWLETT-PACKARD 6 6 7 7 8 55.000 56.000 57.000 58.000 59.000 1 1 1 1 1 ... (C) HEWLETT-PACKARD CO. 1986 ... BEGIN writeln('starting sort'); read_data; sort_data; ^ PREVIOUS ERROR ON PAGE 1 **** ERROR # 3 IDENTIFIER NOT DEFINED (014) 9 60.000 1 write_data; 10 61.000 1 10 62.000 1 writeln('sort done'); 11 63.000 1 END.
LIST_CODE LIST_CODE is an HP Pascal Option. When the LIST_CODE compiler option is ON (and the LIST option is also ON), the compiler produces a mnemonic listing of the object code of each procedure in the program. The mnemonic listing appears at the end of the source listing of the compilation unit. Syntax $LIST_CODE {ON }$ {OFF} Default OFF. Location Anywhere. Scope Applies to the entire compilation unit that contains it.
Parameter string Specifies the name of the file into which the compiler lists the contents of the intrinsic file that BUILDINT specifies. Default 'PASLIST'. Location Anywhere. On MPE the default size is 1023 records. If this record limit is too small, the LISTINTR operation will not complete. You can use the :BUILD command or a :FILE equation to specify a larger file. For more information on :BUILD and :FILE, see the MPE/iX Commands Reference Manual.
LONG ADDR, 8-BIT ALIGNED PARM # 3: SHORTINT(16) at OFFSET 80 by VALUE LITERAL_ALIAS LITERAL_ALIAS is an HP Pascal Option. When the LITERAL_ALIAS compiler option is ON, the compiler takes aliases literally (exactly as they are spelled, differentiating between uppercase and lowercase letters). When LITERAL_ALIAS is OFF, the compiler downshifts aliases (or upshifts them if the compiler option UPPERCASE is ON). Syntax $LITERAL_ALIAS {ON }$ {OFF} Default OFF Location Anywhere.
PROCEDURE proc1; BEGIN . . END; BEGIN . . proc1; . . END. LONG_CALLS LONG_CALLS is an HP Pascal option. The LONG_CALLS option can be used to change the type of branches that are generated for calls or millicode calls. Syntax {integer } $LONG_CALLS {ON }$ {OFF } Parameters 0 or OFF Regular short calls are generated. 1 or ON Long calls are generated for regular calls and millicode calls. 2 Millicode calls are long and regular calls are short. 3 Millicode calls are short and regular calls are long.
Example $LONG_CALLS 1$ program call; procedure p_r(x:real); external; begin p_r(1.5); end. MAPINFO MAPINFO is an HP Pascal Option. The compiler option MAPINFO prints information for array and record types. Syntax $MAPINFO {ON }$ {OFF} Default OFF Location Anywhere. The information printed with the MAPINFO option is the same as that printed with the TABLES option set to ON (see "TABLES" in this chapter.
MLIBRARY is an HP Pascal Option. The MLIBRARY compiler option specifies the file into which the compiler puts a compiled module definition, instead of putting it in the object file. The file specified here can then be used in a SEARCH option (see "SEARCH"). Program comments must not be written on the same line as $MLIBRARY. Syntax $MLIBRARY string $ Parameter string Specifies the name of the file into which the compiler writes the module definition.
$NLS_SOURCE ON$ {Native Mode language source code can appear here.} . . . CONST s = "some string literal"; $NLS_SOURCE OFF$ {Native Mode language source code cannot appear here.} NOTE On MPE/iX, a warning occurs if the NLUSERLANG JCW is not set before compiling a program that turns the NLS_SOURCE compiler option ON. On HP-UX, a warning occurs if the LANG environment variable is not set before compiling a program that turns the NLS_SOURCE compiler option ON. NOTES NOTES is an HP Pascal Option.
Syntax {'LEVEL1' } {'LEVEL2' } $OPTIMIZE {'BASIC_BLOCKS num ' }$ {'BASIC_BLOCKS_FENCE num '} {ON } {OFF } Parameters LEVEL1 The compiler compiles the program with level one optimization. LEVEL2 The compiler compiles the program with level two optimization. [REV BEG] BASIC_BLOCKS num The compiler compiles the program with level two optimization, but drops down to level one for those procedures with more than num basic blocks.
where num is the number of basic blocks a procedure can have before the optimizer drops down to Level 1 optimization. NOTE To get the "old" behavior of -O, (for example, to disable completely the basic blocks feature), you can use the following form of the directive: $OPTIMIZE 'BASIC_BLOCKS 0'$ Notice that 0 has a special meaning here; it does not mean zero basic blocks. On HP-UX, the +Obbnum command-line option can be specified instead of the $OPTIMIZE 'BASIC_BLOCKS num '$ compiler option.
END; {z} PROCEDURE a $OPTIMIZE OFF$; {Compiled with no optimization} PROCEDURE b; {Compiled with no optimization} BEGIN {b}; . . . END; {b}; BEGIN {a} . . . END; {a} BEGIN {x} . . . END. {x} {Compiled with no optimization} OS OS is an HP Pascal Option. The OS compiler option specifies the operating system on which the program is intended to run (not to be confused with the operating system on which it is compiled).
All HP Standard Pascal features. All HP Pascal predefined routines. Predefined procedure assert. Predefined function baddress. Predefined function bitsizeof. Predefined function fnum. Predefined function sizeof. Predefined function waddress. Predefined function ccode. RUN command parameter INFO. RUN command parameter PARM. MPE The compiler recognizes language features that are available on the MPE V operating system. Available features are the same as for MPE/iX.
it. When OVFLCHECK is OFF, integer overflows are not detected. One use for this is in a random number generator, when overflows are expected and are to be ignored. NOTE This option can be used to turn off overflow for bit32 multiplication; this option has no effect on bit52 or longint multiplication.
Location Anywhere. Example PROGRAM show_page (output); BEGIN writeln('First page'); $PAGE$ writeln('Second page'); END. The listing (simplified) looks like this: PAGEWIDTH PAGEWIDTH is an HP Pascal Option. The PAGEWIDTH compiler option specifies the width of the compiler listing. Syntax $PAGEWIDTH integer $ Parameter integer 12- 60 An integer in the range 80..132, the number of characters per line in the compiler listing. Default 120. Location Anywhere.
Example $PAGEWIDTH 80$ PARTIAL_EVAL PARTIAL_EVAL is an HP Standard Option. When the PARTIAL_EVAL compiler option is ON, the compiler produces code that determines the value of each Boolean expression by evaluating the minimum number of operands, from left to right. When the PARTIAL_EVAL option is OFF, the compiler produces code that evaluates every operand of each Boolean expression in an implementation dependent order. Syntax $PARTIAL_EVAL {ON }$ {OFF} Default ON. Location Statement.
Compiler options with the location "At front" are not affected by POP. The following compiler options are not affected by POP either: ALIAS COPYRIGHT ELSE ENDIF EXTERNAL FONT GLOBAL IF INCLUDE LOCALITY PAGE POP PUSH SKIP_TEXT SUBPROGRAM SYSINTR TITLE Example {Include file for supporting types.} $PUSH, LIST OFF$ {Do not list the supporting types. To preserve the LIST state (ON or OFF) that this program set, save it first} TYPE bit1 = 0..1; bit2 = 0..2; bit3 = 0..7; . . . bit16 = 0..
. . bit16 = 0..32767; $POP$ TYPE posshortint = bit16; . . . RANGE RANGE is an HP Standard Option. When the RANGE compiler option is ON, the compiler generates range-checking code for assignments, array indices, parameter passing, extensible parameters, pointers, CASE statements, and set operations. If a range check fails, an error message is issued and the program aborts (or causes an escape to be executed if a TRY-RECOVER construct is active). The command line option +R also specifies this option.
When RLFILE is ON, the compilation unit goes into an RL file procedure by procedure. This allows procedural-level manipulation similar to that on MPE V. An error occurs if the object file exists, but is not an RL file (that is, if it is an NMOBJ file). If the object file is an existing RL file, object modules replace existing modules in the RL file. If the object file does not exist, an RL file is created with the specified name.
modulename_procedurename instead of procedurename when linking a program. The name modulename_procedurename is in lowercase letters (as far as the linker is concerned) unless the procedure was compiled with the compiler option UPPERCASE ON. The S300_EXTNAMES option applies to the entire module, but not to other modules in the same compilation unit. If a compilation unit contains several such modules, each one must contain the S300_EXTNAMES option.
'[+]file_name [, file_name ]...' The compiler searches the file_name s (in the order specified) for module definitions. If + is specified, the compiler concatenates this list of file names to the existing list (which was created by previous SEARCH options). If + is not specified, this list of file names replaces the existing list. (Note that + can only appear before the first string.) An empty string resets the search list to the default. Default Location On MPE/iX: PASLIB.PUB.
The object files a.o, b.o, and c.o must be specified to the linker for the example program to be successfully linked. SET SET is an HP Pascal Option. The SET compiler option assigns a Boolean value (TRUE or FALSE) to each of one or more identifiers that appear in subsequent IF options. Syntax $SET identifier =Boolean [{,} identifier =Boolean ]'$ [{;} ] Parameters identifier Appears in an IF option later in the program. identifier cannot be AND, OR, or NOT.
Syntax {integer } $SHLIB_CODE {ON }$ {OFF } Parameters integer Must be in the range 0..2. Value Compiler generates: 0 Position dependent code. 1 Short load sequence PIC. 2 Long load sequence PIC. ON Compiler generates short load sequence PIC. OFF Compiler generates position dependent code. Default OFF (Position dependent code). Location At front. Command Line Option +z or +Z Programs that have been linked to shared libraries (.
SHLIB_VERSION is designed to be used with the SHLIB_CODE compiler option. For more information about shared library version control, refer to Programming on HP-UX. SKIP_TEXT SKIP_TEXT is an HP Pascal Option. The compiler ignores everything between $SKIP_TEXT ON$ and $SKIP_TEXT OFF$. Syntax $SKIP_TEXT {ON }$ {OFF} Default OFF Location Anywhere. Example PROGRAM show_skiptext (output); BEGIN writeln('This will print.'); $SKIP_TEXT ON$ writeln('This won''t print.
as the SYSINTR compiler option and is provided only for backward compatibility with Pascal/V. Syntax $SPLINTR [string ]$ Parameter string Specifies the name of the intrinsic file that the compiler must search for information about intrinsic routines. This intrinsic file must be in SYSINTR format, not SPLINTR format (see Table 12-2 in "SYSINTR"). Default System intrinsic file (see the HP Pascal/iX Programmer's Guide or the the HP Pascal/HP-UX Programmer's Guide, depending on your implementation).
A standard level violation (use of a language feature that is not available at the current standard level) causes the compiler to issue a warning, except if the violation involves a reserved word, in which case it is an error. NOTE The STANDARD_LEVEL compiler option also accepts the Pascal/V standard levels 'HP' and 'HP3000', which it treats like 'HP_PASCAL'.
STATEMENT_NUMBER STATEMENT_NUMBER is an HP Pascal Option. When the STATEMENT_NUMBER compiler option is ON, the compiler generates a special instruction to identify a code sequence with its corresponding Pascal statement. Syntax $STATEMENT_NUMBER {ON }$ {OFF} Default OFF Location Anywhere. The special instruction that the compiler generates is a LoaD Immediate Left (LDIL) instruction with destination register R0. It is equivalent to a No OPeration (NOP) instruction.
STDPASCAL_WARN STDPASCAL_WARN is an HP Pascal Option. The STDPASCAL_WARN compiler option allows you to compile and execute syntax, which otherwise would have been issued an error message due to non-conformity with the ANSI/ISO standard. A new error message can now be issued for syntax in HP Pascal that does not conform to the ANSI/ISO standard. This message may be issued only when one of the following compiler options is specified: ANSI ON, STANDARD_LEVEL 'ANSI', or STANDARD_LEVEL 'ISO'.
__________________________________________________________ NOTE This value must include the length word of the string and any padding. __________________________________________________________ Default 0 (each request is allocated from the heap with the exact size required). Location Heading. Example The following example shows two cases where the compiler can not determine the size of a string at compile time.
$SUBPROGRAM 'Proc1,Proc2'$ and $SUBPROGRAM 'Proc1'$ $SUBPROGRAM 'Proc2'$ The SUBPROGRAM option enables you to compile selected routines of a program. The compiler checks the syntax and semantics of the entire program, but generates object code for the selected routines only. Example 0 0 0 0 0 0 2 2 3 3 0 2 2 3 3 1.000 2.000 3.000 4.000 5.000 6.000 7.000 8.000 9.000 10.000 11.000 12.000 13.000 14.000 15.
Syntax $SYMDEBUG ['XDB ]$ ['TOOLSET'] Parameters None The HP Symbolic Debugger for the HP-UX operating system; HP TOOLSET/XL for the MPE/iX operating system. XDB Emits information for the HP Symbolic Debugger, for either the HP-UX or MPE/iX operating system. TOOLSET Emits information for the HP TOOLSET/XL debugger. (Only the MPE/iX operating system allows HP TOOLSET/XL.) Default None. Location At front. Example $SYMDEBUG 'XDB'$ PROGRAM any_program; BEGIN . . . END.
TYPE LogArray = ARRAY [1..80] OF shortint; PROCEDURE FCheck; INTRINSIC; {FCheck comes from the system intrinsic file} $SYSINTR 'MYINTR'$ PROCEDURE FWrite; INTRINSIC; {FWrite comes from MYINTR} $SYSINTR$ FUNCTION FRead ( FileNum : shortint; VAR Target : LogArray; TCount : shortint) : shortint; INTRINSIC; {This FRead description is compared to the one in the system intrinsic file.} Table 12-2 compares SPLINTR (SPL) and SYSINTR (HP Pascal) formats.
TABLES TABLES is an HP Pascal Option. When the TABLES compiler option is ON (and the LIST option is also ON), the listing includes an identifier map for each compilation block. Syntax $TABLES {ON }$ {OFF} Default OFF. Location Anywhere. In order for the listing to contain a table of a specific compilation block, the TABLES and LIST options must be ON when the compiler finishes parsing that block.
Value Meaning DP+ The offset is relative to the contents of the DP register (the "Data Pointer," register 27). This register points to the base of the global variables. Its value can be displayed in an assembly-level debugger. SPThe offset is a negative offset from the contents of the SP register (the "Stack Pointer," register 30). This register points to the top of the activation record of the currently executing routine. Its value can be displayed in an assembly-level debugger.
3 3 4 5 6 7 8 9 9 9 10 0 2 2 3 3 4 4 6 7.000 8.000 9.000 10.000 11.000 12.000 13.000 14.000 15.000 16.000 17.000 18.000 19.000 20.000 21.000 22.000 23.000 24.000 25.000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 TYPE answer = (yes,no); rec = RECORD ch : char; CASE tag : answer OF yes : (message : PACKED ARRAY [1..
GLOBAL STORAGE USED = 18 PARAMETER STORAGE USED = 0 TEMPORARY STORAGE USED = 0 CONSTANT STORAGE USED = 0 TITLE TITLE is an HP Pascal Option. The TITLE compiler option specifies the title to appear on subsequent pages of the listing. (The title appears next to the page number in the top left-hand corner of the page.) Syntax $TITLE string_literal $ Parameter string_literal Exact title (the compiler distinguishes between uppercase and lowercase letters.) The empty string ( '') restores the default title.
CONVERSION Permits value type coercion of ordinal and pointer types. This is the most useful and transportable form of type coercion. STRUCTURAL Permits coercion of any data type to any structurally compatible data type. (This is equivalent to renaming components. It is fully transportable.) REPRESENTATION Permits coercion of any data type to any representation-size compatible data type. Representation-size compatible types have identical BitSizeof values.
The LITERAL_ALIAS compiler option overrides the UPPERCASE compiler option in aliases. Syntax $UPPERCASE {ON }$ {OFF} Default OFF. Location Anywhere, but if you want the compiler to upshift the program parameter names, then UPPERCASE must precede the program header. Scope All subsequent external names. If program parameter names are to be upshifted, then UPPERCASE must precede the program header. Example $UPPERCASE ON$ PROCEDURE proc1; {External name is "PROC1".
VOLATILE VOLATILE is an HP Pascal Option. You can apply the VOLATILE compiler option to a variable to specify that the memory location associated with the variable may be modified by other processes. Using VOLATILE signals the optimizer that a specified variable must not reside in a register, but must always be updated. Syntax $VOLATILE$ Location The VOLATILE compiler option is allowed after the ":" in a VAR declaration. It is also allowed after a "^" in a pointer type or variable declaration.
Default 132. Location Anywhere. The WIDTH option allows the compiler to ignore text beyond a specified column. The WIDTH option applies only to the file that contains it, and not to files that it includes (see the INCLUDE option). If File1 with width n includes File2, the width while File2 is being included is specified by File2 (if File2 does not contain a WIDTH option, the width defaults to 132.) At the end of File2, the width returns to n.
Example 0 0 0 0 0 0 1 1 2 0 2 2 4 5 1.000 2.000 3.000 4.000 1.000 2.000 5.000 6.000 7.000 8.000 9.000 10.000 11.000 12.000 0 0 0 0 0 0 0 0 0 0 1 1 1 1 $XREF ON$ $TITLE 'Show_xref'$ PROGRAM show_xref (input,output); $INCLUDE 'const'$ CONST k = 100; VAR n : integer; t : Boolean; PROCEDURE check (VAR b : Boolean); BEGIN IF n > k THEN b := true ELSE b := false; END; C R O S S --------- Page Line # Page R E F E R E N C E ----------------- Line # Page Line # Page Line # Page Line # B PXA32.
PXA32.EXAMPLES.ATFTEST 1 00008.000 1 0015.000 FALSE PXA32.EXAMPLES.ATFTEST 1 00011.000 INPUT PXA32.EXAMPLES.ATFTEST 1 00003.000 INTEGER PXA32.EXAMPLES.ATFTEST 1 00006.000 K PXA32.EXAMPLES.ATFTEST 1 00010.000 const 1 00002.000 N PXA32.EXAMPLES.ATFTEST 1 00006.000@ 1 00010.000 1 00014.000* OUTPUT PXA32.EXAMPLES.ATFTEST 1 00003.000 READLN PXA32.EXAMPLES.ATFTEST 1 00014.000 SHOW_XREF PXA32.EXAMPLES.ATFTEST 1 00003.000 T PXA32.EXAMPLES.ATFTEST 1 00007.000 PAGE 3 1 00015.000* 1 00016.
12- 88
Appendix A Error Messages On HP-UX, error messages and their explanatory text are in the file named /usr/lib/paserrs. To list this file, use the command: cat usr/lib/paserrs On MPE/iX, error messages and their explanatory text are in the file named PASXLCAT.PUB.SYS. To list this file, use the command: :PRINT PASXLCAT.PUB.SYS In reading the error messages, note that: * A dollar sign ($) in the left margin indicates a comment line containing explanatory text.
8. When a value is established for the tag field of a record with variants, it is illegal to use a field in another variant. 9. The compiler does not always detect uninitialized variables, especially in these cases: a. The path to use a variable cannot include the initializing statement. Suppose: PROCEDURE proc_a; VAR x,y : integer; BEGIN IF condition THEN x := 10 ELSE y := x; . . .
Using This Appendix This appendix describes the errors, notes, and warnings that can be detected during the compilation or execution of an HP Pascal program. These errors are listed in numeric order. The text of each message is followed by a brief explanation of the situation, the CAUSE. When it is necessary for the user to do something, there is an ACTION following the particular CAUSE. In some cases there may only be one action for several causes.
Messages 001-200 --------------------------------------------------------------------------------------001 MESSAGE FLOATING POINT OVERFLOW (001) CT CAUSE The absolute value of a real number is too large. ACTION Check the permitted range of real/longreal values. --------------------------------------------------------------------------------------002 MESSAGE FLOATING POINT UNDERFLOW (002) CT CAUSE The absolute value of a real number is non-zero and too small.
--------------------------------------------------------------------------------------008 MESSAGE END OF FILE FOUND BEFORE EXPECTED (008) CT CAUSE The compiler expects more source code. There may be an unmatched BEGIN-END or an unclosed comment. ACTION Check for missing END, semicolon, period, or incomplete statement. Also check for an unclosed comment or $SKIP_TEXT ON$.
or function. The type identifier is undeclared. ACTION Add identifier to the declaration section. --------------------------------------------------------------------------------------015 MESSAGE INVALID VARIABLE USE (015) CT CAUSE The control variable of a FOR loop is being modified in the statement component of the FOR loop. For example: * It is the control variable of a nested FOR loop. * It appears on the left side of an assignment statement.
function that is not legal in a constant expression. The expression contains constant operands that are not legal; for example, set or Boolean values. ACTION Check the constant expression for a variable, or illegal type of operand.
ACTION Remove "! " or correct earlier error. --------------------------------------------------------------------------------------026 MESSAGE MISSING "! " (026) CT CAUSE The compiler expected this token, but it was omitted or misspelled. The correct token was inserted. ACTION Insert "! " --------------------------------------------------------------------------------------027 MESSAGE "! " FOUND BEFORE EXPECTED. SOURCE MISSING.
ACTION Check the file name. --------------------------------------------------------------------------------------033 MESSAGE MISSPELLED RESERVED WORD: "! " (033) CT CAUSE The reserved word is misspelled. ACTION Correct the spelling of the reserved word. --------------------------------------------------------------------------------------034 MESSAGE FORWARD TYPE "! " NOT FOUND (034) CT CAUSE The identifier occurs in a pointer type definition but is not subsequently defined.
an assigning reference. ACTION Initialize the variable before it is used. --------------------------------------------------------------------------------------040 MESSAGE INVALID STRING TYPE USE (040) CT CAUSE The standard type identifier string is not used to define a string type. ACTION Use the standard identifier string to define this type.
--------------------------------------------------------------------------------------060 MESSAGE OPERAND NOT OF TYPE BOOLEAN (060) CT CAUSE A non-Boolean operand appears with the operator NOT, OR, or AND. ACTION Change the operator to a Boolean type. --------------------------------------------------------------------------------------061 MESSAGE WRONG TYPE OF OPERAND FOR ARITHMETIC OPERATOR (061) CT CAUSE A nonnumeric operand appears with an arithmetic operator.
the component to which it is being assigned. The subrange type of the expression being assigned does not intersect the type of the receiving entity. ACTION Check the assignment compatibility rules. --------------------------------------------------------------------------------------067 MESSAGE TYPE OF EXPRESSION NOT ALLOWED IN SUBRANGE (067) CT CAUSE The expression defining a subrange bound is not an ordinal expression. ACTION Replace the expression with an ordinal expression.
--------------------------------------------------------------------------------------081 MESSAGE ARRAY ELEMENT TYPES NOT EQUIVALENT (081) CT CAUSE PACK and UNPACK array parameters must have identical component types. ACTION Use identical component types. --------------------------------------------------------------------------------------082 MESSAGE INVALID ARRAY SIZE (082) CT CAUSE The size of the array is too big for the compiler. In PACK or UNPACK the destination array is not large enough.
088 MESSAGE INCORRECT NUMBER OF INDICES FOR STRING DECLARATION (088) CT CAUSE A string can only have one index in a declaration. No index was supplied in a string declaration. ACTION Use only one index in a string declaration.
ACTION Declare and supply a pointer variable. --------------------------------------------------------------------------------------106 MESSAGE MISSING TAG VALUES FOR TAG TYPE (106) CT CAUSE Not all tag values for a tag type in the record are specified. ACTION Add empty variant declarations for the missing tag values.
here. CAUSE A constructor occurs as an element of a set or string constructor. ACTION Remove the constructor from the set or string. --------------------------------------------------------------------------------------141 MESSAGE RECORD CONSTANT HAS MISSING FIELD(S) (141) CT CAUSE One or more fields missing in a record constructor. The name of a field is misspelled. ACTION Correct erroneous field name. Add the missing fields.
--------------------------------------------------------------------------------------147 MESSAGE CONSTRUCT ONLY ALLOWED IN CONSTRUCTORS (147) CT CAUSE OF is used outside of a constructor. ACTION Remove the OF from the code.
current procedure header. ACTION Rename one of the duplicate identifiers. --------------------------------------------------------------------------------------153 MESSAGE NOT ALLOWED AS AN ANYVAR PARAMETER (153) CT CAUSE A parameter can not be an AnyVar parameter and a conformant array parameter. ACTION Change the formal parameter specifier to VAR or omit it.
158 MESSAGE CRUNCHED CONFORMANT ARRAYS ARE NOT ALLOWED (158) CT CAUSE Conformant array parameters cannot be CRUNCHED. ACTION Remove CRUNCHED, or change to PACKED. --------------------------------------------------------------------------------------159 MESSAGE NO PACKED CONFORMANT ARRAYS OF CONFORMANT ARRAYS (159) CT CAUSE Packed conformant arrays cannot have, as their elements, conformant arrays. ACTION Add PACKED to the inner type. type.
165 MESSAGE DEFAULT FILE INPUT MUST BE IN PROGRAM PARAMETER LIST (165) CT CAUSE The file variable in a standard procedure or function call was defaulted to INPUT, but INPUT was not declared in the program parameter list. ACTION Either add 'INPUT' to the program heading or remove the redefinition of 'INPUT', if one was made.
192 MESSAGE PARAMETER "! " DOES NOT MATCH POSSIBLE SPL TYPES (192) CT CAUSE The HP Pascal type of the parameter does not correspond to an acceptable SPL type. ACTION Change the parameter definition to a type that will correspond to the SPL type.
CT CAUSE The identifier used in the procedure call either has not been declared, or it is not a procedure name. ACTION Check the spelling of the procedure and make sure it is declared. --------------------------------------------------------------------------------------200 MESSAGE PARAMETER "! " MUST BE VAR PARAMETER. (200) CT CAUSE The parameter in the intrinsic declaration was specified as a value parameter, but the intrinsic requires a reference parameter.
ACTION Make sure all routine options or compiler options are repeated in the definition of the procedure or function. --------------------------------------------------------------------------------------204 MESSAGE INVALID DIRECTIVE (204) CT CAUSE EXTERNAL, EXTERNAL SPL, EXTERNAL SPL VARIABLE, EXTERNAL FORTRAN, EXTERNAL FTN77, EXTERNAL C, EXTERNAL COBOL, FORWARD, and INTRINSIC are the only legal directives. ACTION Remove the directive from the code or correct the spelling.
accepted by the predefined routine. CAUSE This actual parameter is not intrinsic compatible with the intrinsic parameter. ACTION Check the types of the actual parameter and the intrinsic parameter. CAUSE The parameter of the standard SQR function is an integer subrange type with a lower bound greater than the square root of maxint, or an upper bound less than the negation of the square root of maxint. In either case, an integer overflow is possible at run time. ACTION Do not call SQR.
CT CAUSE This value formal parameter is a file or a structured type with a file type component. This is equivalent to assigning to a file. ACTION Remove the file component from the source code. --------------------------------------------------------------------------------------214 MESSAGE FUNCTION TYPE MAY NOT CONTAIN FILE COMPONENT (214) CT CAUSE This function return type is a file or a structured type that contains a file type component. This is equivalent to assigning to a file.
218 MESSAGE INTRINSIC FILE NOT CHECKED (218) CT CAUSE Due to a prior error, the intrinsic file was never opened. Thus, no attempt was made to look up this procedure or function. ACTION Fix the previous error and try again. --------------------------------------------------------------------------------------219 MESSAGE "STRING" IS NOT ALLOWED AS A VALUE PARAMETER (219) CT CAUSE A string formal value parameter must have a specified maximum length.
or functional parameter. The parameter of a call to WADDRESS or SIZEOF is a component of a packed structure. The parameter of a call to BADDRESS is a component of a packed structure other than a PAC. Either the third parameter of a call to ASSERT is not a procedure identifier or the parameter of such a procedure is not an integer value parameter. ACTION Check the types of the actual and formal parameters.
229 MESSAGE INCONGRUENT FORMAL PARAMETER SECTIONS (229) CAUSE The formal parameter sections of the actual routine being passed as a parameter are not congruent with the formal parameter sections of the procedural or functional parameter of the called routine. ACTION Alter one of the formal parameter sections so that it is congruent with the other. Raise the STANDARD_LEVEL to HP_PASCAL.
CT CAUSE Every module must have at least one EXPORT. ACTION Declare or define at least one 'object' in the EXPORT section. --------------------------------------------------------------------------------------242 MESSAGE INVALID IMPORT MODULE IDENTIFIER (242) CT CAUSE The given identifier is not defined. The given identifier is not the name of a module in the current $SEARCH$ list. ACTION Check the name of the IMPORT module identifier.
A colon ( : ) appears or was inserted by the compiler where no label was desired. ACTION Check to ensure that the label is an integer between 0 and 9999. --------------------------------------------------------------------------------------271 MESSAGE LABEL HAS NOT BEEN DECLARED (271) CT CAUSE This label marks a statement, but never appeared in a LABEL declaration for this block. ACTION Declare the label.
statement. ACTION Remove either the label or the GOTO from the code. --------------------------------------------------------------------------------------293 MESSAGE TSAM INTRINSIC ERROR "! " (293) CT CAUSE An error was encountered when reading a TSAM (toolset format) file. ACTION The error number replacing "! " refers to Toolset error messages if 900 or above. Look them up in a Toolset manual. Please report other numbers to your local HP representative.
--------------------------------------------------------------------------------------378 MESSAGE WHICH IS A COMPONENT OF ' ! '(378) N CAUSE This message accompanies message #379. ACTION See message 379. --------------------------------------------------------------------------------------379 MESSAGE THE FIELD / AN ELEMENT OF ' ! ', CROSSES A WORD BOUNDARY (379) N CAUSE Accesses of ordinal data items split across word boundaries are relatively inefficient.
385 MESSAGE POSSIBLE NON-ALIGNED OVERLAPPING SOURCE/TARGET IN STATEMENT ! (385) N CAUSE The source and target of the MOVE predefined procedure may overlap and generate scrambled results. ACTION You may need to use MOVE_R_TO_L or MOVE_L_TO_R. --------------------------------------------------------------------------------------400 MESSAGE INVALID FILENAME (400) CT CAUSE The filename given in the INCLUDE, SYSINTR, or SPLINTR option is not a legal filename.
CT CAUSE Misspelled true/false after "= " in $SET$ ACTION Correct spelling. CAUSE Missing true/false after "= " in $SET$ ACTION Add TRUE or FALSE. --------------------------------------------------------------------------------------408 MESSAGE UNMATCHED $ENDIF$ OR $ELSE$ FOUND (408) CT CAUSE $ENDIF$/$ELSE$ compiler option was found without a preceding $IF$ option. This may happen either if the compiler rejects an $IF$ because it was out of place, or if the $IF$ is not in the code.
--------------------------------------------------------------------------------------414 MESSAGE NLS NOT INSTALLED OR SYSTEM VARIABLE NOT SET (414) CT CAUSE NLS (Native Language Support) is not installed or the JCW 'GETUSERLANG" is not set (MPE/iX) or the environment variable 'LANG' is not set (HP-UX). ACTION Determine which of the above applies and correct the situation.
PASXDATA=200; export PASXDATA setenv PASXDATA 200 for sh or ksh for csh --------------------------------------------------------------------------------------461 MESSAGE PARSER STACK OVERFLOW - TOO MANY NESTED CONSTRUCTS (461) CT CAUSE An internal compiler limit on nested structures has been reached. A common cause is a long list of ELSE-IFs. ACTION Break up a nested structure. structure.
505 MESSAGE STRING PARAMETER IS REQUIRED, OPTION IGNORED (505) W CAUSE This option requires information in a string literal parameter. ACTION Check the option argument; check the compiler option syntax. --------------------------------------------------------------------------------------506 MESSAGE I/O FAILED ON FILE !, ! (506) CAUSE I/O on a file failed. The compiler feature that uses that file has been disabled for the remainder of the compilation.
expression underflows. For example: VAR A: maxint - 10..maxint; B: minint..minint + 10 Then the expression B - A would be less than minint + 10 maxint, which is less than minint. (b) the addition, subtraction, or multiplication of two constants resulting in an underflow. ACTION Correct the expression.
W CAUSE A NEW was called specifying a tag constant that did not appear in the case list in the variant part. The maximum space for the record is allocated. ACTION Remove the variant identifier from the source code or correct its spelling.
523 MESSAGE INTEGER CONSTANT IS REQUIRED - OPTION IGNORED (523) W CAUSE This compiler option requires an integer parameter; such as WIDTH. The compiler has ignored this option. ACTION Check the syntax and insert an integer where necessary. --------------------------------------------------------------------------------------524 MESSAGE SUBPROGRAM "! " SPECIFIED, BUT NOT FOUND (524) W CAUSE A procedure or function name specified in the SUBPROGRAM option was not found in the source.
functions wi th names which are identical within the first 15 characters. --------------------------------------------------------------------------------------530 MESSAGE EXPRESSION WILL CAUSE A RUN-TIME SET RANGE ERROR (530) W CAUSE Evaluation of a set construction in which an element of the set list will necessarily fall outside the bounds of the set construction will cause this error. ACTION Check the source code and fix the expression.
W CAUSE New functionality has been added of which the user should be aware. ACTION None. --------------------------------------------------------------------------------------538 MESSAGE THIS FEATURE REQUIRES $OS "! " (538) W CAUSE The current $OS is not one that allows the feature. ACTION Use the $OS specified in the message or remove the feature.
ACTION Change the source to use the recommended features and recompile. --------------------------------------------------------------------------------------552 MESSAGE SYSTEMS LANGUAGE VARIABLE NOT SET (552) W CAUSE JCW 'NLUSERLANG' or environment variable 'LANG' not set. ACTION Set the system variable to the desired language (-LANG on HP-UX, NLUSERLANG on MPE/iX.
ALIGNMENT option from the type declaration for the pointer or by rearranging the fields of the record containing the pointer. --------------------------------------------------------------------------------------558 MESSAGE FILES APPEAR IN THE VARIANT PART OF A RECORD (558) W CAUSE Fields of a file type or a structure containing a file type appear in the variant part of a record. When this variant becomes inactive, all fields in that variant are undefined.
ACTION Specify the num in the $OPTIMIZE 'BASIC_BLOCKS num '$ directive. ACTION On HP-UX, specify the num on the command-line with +Obbnum. ACTION On HP-UX, specify 0 as num to guarantee the "old" -0 behavior (that is, not ever dropping down to level 1 optimization).
W CAUSE Both OPTIMIZE and SYMDEBUG 'TOOLSET' options are present. options are mutually exclusive. ACTION (1) If SYMDEBUG 'TOOLSET' is desired, remove OPTIMIZE. (2) If OPTIMIZE is desired, remove SYMDEBUG 'TOOLSET'. The --------------------------------------------------------------------------------------575 MESSAGE VALUE OF ESCAPECODE IS QUESTIONABLE HERE (575) W CAUSE The value returned by ESCAPECODE outside a RECOVER construct is undefined.
ACTION Correct the alignment value. --------------------------------------------------------------------------------------588 MESSAGE POSSIBLE USE OF UNINITIALIZED FIELD '!' OF '!' (588) W CAUSE The field of the local variable mentioned in the message may be uninitialized when used in this procedure or function. ACTION Ensure that the field is initialized before use.
W CAUSE EXPORT qualifiers currently have no effect. ACTION No action is required. --------------------------------------------------------------------------------------596 MESSAGE DUPLICATE IMPORTED MODULE (596) W CAUSE ! ACTION Rename one of the modules. is the same as .
--------------------------------------------------------------------------------------602 MESSAGE REPEATED USE OF DISPOSE ON GIVEN PARAMETER (PASCERR 602) RT CAUSE The pointer parameter to dispose identifies an area previously deallocated by dispose. ACTION Do not DISPOSE a pointer that has been released.
607 MESSAGE RELEASE PARAMETER ENCLOSES GETHEAP AREA(S) (PASCERR 607) RT CAUSE The parameter to release identifies an area containing areas the user allocated with GETHEAP procedure, but which have not yet been deallocated with the RTNHEAP procedure. ACTION RTNHEAP must be used to release areas allocated by GETHEAP.
ACTION 1. A field has been assigned to in a variant different than the one specified in a call to new. 2. A pointer to a disposed area, such as a dangling pointer, has been dereferenced in an assignment. 3. There is a mismatch of data types. Check to see that the routine calling NEW or GETHEAP uses the same declaration for the pointer as the routine which makes an assignment through it (for separate compilations). According to above causes.
RT CAUSE The maximum value of an ordinal type or subrange was the parameter to SUCC. The result is undefined. ACTION Do not call SUCC with the highest value of an ordinal type. --------------------------------------------------------------------------------------625 MESSAGE SET RANGE ERROR (PASCERR 625) RT CAUSE An attempt was made to assign a set to a set variable when the set contains an element not within the set range of the variable.
RT CAUSE An attempt was made to index beyond the current length of the string. ACTION Correct the argument or the program logic. --------------------------------------------------------------------------------------652 MESSAGE DESIGNATED CHARACTER POSITION(S) OUTSIDE STRING (PASCERR 652) RT CAUSE The specified offset is greater than the current length of the string, or less than 1. ACTION Correct either the argument or the program logic.
contain only valid characters in the particular base. --------------------------------------------------------------------------------------673 MESSAGE NUMBER OF SIGNIFICANT DIGITS CAUSED OVERFLOW (PASCERR 673) RT CAUSE The number of significant digits was more than 32 for the standard function BINARY, 11 for the function OCTAL, or 8 for the function HEX. ACTION Correct the argument to the numeric conversion function to be a representable value.
695 MESSAGE ERROR OCCURRED WHILE WRITING TO FILE (PASCERR 695) RT CAUSE A Pascal FILE variable has been corrupted. ACTION Correct the file system problem or program error that is corrupting the HP Pascal file such as an array out of bounds with RANGE OFF or dereferencing an invalid pointer. CAUSE An attempt is made to write past the physical unit of the file. ACTION Increase the file's physical limit.
ACTION Correct the input. --------------------------------------------------------------------------------------702 MESSAGE INPUT VALUE OVERFLOW (PASCERR 702) RT CAUSE The numeric value read is too large for the type of the variable. ACTION Correct the input. --------------------------------------------------------------------------------------703 MESSAGE ATTEMPT TO WRITE PAST PHYSICAL BOUNDS OF FILE (PASCERR 703) RT CAUSE The current record position is past the physical limit of the file.
error that corrupted the Pascal FILE variable (such as array reference out of bounds with RANGE OFF or dereferencing an invalid pointer.) --------------------------------------------------------------------------------------709 MESSAGE FIELD WIDTH LESS THAN ZERO (PASCERR 709) RT CAUSE The field width in a formatted write of a nonnumeric expression was less than zero. ACTION Correct the program logic so it doesn't use negative values for the field width or decimal position.
--------------------------------------------------------------------------------------716 MESSAGE CANNOT WRITE ENUMERATED VALUE (PASCERR 716) RT CAUSE An attempt was made to write an enumerated variable to a textfile, but the current ordinal value of the variable is not within the range of the enumerated type. ACTION Check the program's logic.
722) RT CAUSE An attempt was made to associate a file that was not opened with a system provided open routine. Instead, the file was opened with a PASCAL open routine. ACTION Open the file with a system provided open routine such as MPE/iX "FOPEN" or HP-UX "OPEN" before using "associate." --------------------------------------------------------------------------------------723 MESSAGE MISSING OPTIONS TO "ASSOCIATE" (PASCERR 723) RT CAUSE The option string passed to the associate routine was empty.
810 MESSAGE COERCION REQUIRES $TYPE_COERCION 'STORAGE'$ (810) CT CAUSE The current $TYPE_COERCION 'string'$ is insufficient to permit this type coercion. ACTION Set the type_coercion level to that given in the message. --------------------------------------------------------------------------------------811 MESSAGE COERCION REQUIRES $TYPE_COERCION 'NONCOMPATIBLE'$ (811) CT CAUSE The current $TYPE_COERCION 'string'$ is insufficient to permit this type coercion.
CT CAUSE There was an attempt to type coerce NIL. There was an attempt to type coerce a procedure name. ACTION Remove the type coercion. --------------------------------------------------------------------------------------820 MESSAGE BIAS IS LESS THAN MINIMUM ARRAY INDEX (820) CT CAUSE The bias parameter to a MOVE procedure will always cause an index range error before the move is completed. ACTION Fix the bias parameter or count parameter.
ACTION Consult the HP Pascal Reference Manual for details. --------------------------------------------------------------------------------------828 MESSAGE MISSING DEFAULT VALUE FOR "! " (828) CT CAUSE This parameter requires a default value to be specified. ACTION Supply a default value in the "default_parms" option.
CT CAUSE A routine option specified a formal parameter that was not declared in the formal parameter list. ACTION Check the formal parameter list. --------------------------------------------------------------------------------------838 MESSAGE DUPLICATE FORMAL PARAMETER FOR THIS ROUTINE OPTION (838) CT CAUSE A routine option specified a formal parameter twice. ACTION Remove the duplicate specification.
847 MESSAGE NOT A VARIABLE DEFAULT FORMAL PARAMETER (847) CT CAUSE A formal parameter to the Haveoptvarparm function is not a VAR or ANYVAR parameter. ACTION Check the formal parameter list. Haveoptvarparm. Remove this call to --------------------------------------------------------------------------------------848 MESSAGE NOT AN EXTENSION FORMAL PARAMETER (848) CT CAUSE A formal parameter to the Haveextparm function is not an extensible parameter.
definition. ACTION Remove the feature from the source code. --------------------------------------------------------------------------------------859 MESSAGE ANYPTR MAY NOT BE DEREFERENCED (859) CT CAUSE Pointers of type ANYPTR may not be dereferenced. ACTION Assign or type coerce the pointer before dereferencing it.
ACTION Remove the second parameter. --------------------------------------------------------------------------------------866 MESSAGE NO ANYVAR FOUND IN FORMAL PARAMETER LIST (866) CT CAUSE A procedure or function declared with OPTION UNCHECKABLE ANYVAR must have an ANYVAR parameter in its formal parameter list. ACTION Remove the option or supply an ANYVAR.
CAUSE If only one of the parameters is crunched, then the elements must be packed in with no wasted space between elements. ACTION Check the packing. --------------------------------------------------------------------------------------872 MESSAGE ARRAY ELEMENTS CANNOT BE CONFORMANT ARRAYS. (872) CT CAUSE If an array parameter to one of the MOVE routines is a conformant array, then its elements must not themselves be conformant arrays. The size of the elements must be known at compile time.
CT CAUSE ACTION The address of an inlined routine is being requested. happens in the following cases: This * The procedure is passed as a parameter to WAddress, BAddress, Addr or Assert (as the "assert procedure"). * The procedure is passed as the actual parm when the formal parm is a procedural/functional type. Don't use option inline if the procedure is being used in the above contexts.
not allowed. ACTION Don't mix modes in data declarations. --------------------------------------------------------------------------------------883 MESSAGE COERCION REQUIRES $TYPE_COERCION 'CONVERSION'$ (883) CT CAUSE The current $TYPE_COERCION$ level is insufficient to permit this coercion. ACTION Set the $TYPE_COERCION$ level to that given in the message.
--------------------------------------------------------------------------------------890 MESSAGE CANNOT EXPORT AN IMPORTED MODULE IN THE OUTER BLOCK (890) CT CAUSE The word EXPORT was seen after the module name on an import statement in the outer block. ACTION Remove the word EXPORT. --------------------------------------------------------------------------------------891 MESSAGE LISTINTR FAILED TO COMPLETE SUCCESSFULLY (891) CT CAUSE The listing of the intrinsic file terminated unexpectedly.
The static nesting level of the value does not correspond to the current state of the activation stack. The value is NIL. The procedure or function is uninitialized or contains a bad value. ACTION Make sure the procedure or function has been initialized correctly.
--------------------------------------------------------------------------------------914 MESSAGE GOTO EXECUTED BUT CANNOT UNWIND DESCRIPTOR FOR THE FRAME (914) RT CAUSE A non-local GOTO was executed, but one or more of the procedures in the program stack has a frame that is not unwindable. ACTION Contact Hewlett-Packard. --------------------------------------------------------------------------------------5001 MESSAGE GOTO OUT OF BLOCK TO MULTIPLE ENTRY PT.
5207 MESSAGE MULTIPLE PROGRAM ENTRY POINTS (5207) CT CAUSE Possible multiple main programs. ACTION Make sure only one main program exists in the compilation unit. --------------------------------------------------------------------------------------5208 MESSAGE TOO MANY NESTED TRYS IN PROCEDURE (5208) CT CAUSE The maximum number of nested TRYs allowed in a procedure is about thirty. ACTION Break up your procedure by putting some of the inner TRY blocks into a nested procedure.
ACTION Check for duplicate labels. If none are found, report this error to your HP Service Representative. --------------------------------------------------------------------------------------5213 MESSAGE CANNOT OPEN ASSEMBLY FILE (5213) CT CAUSE The compiler could not open the assembly file. because: This may be (a) You do not have write permission in the group (on MPE/iX) or directory (on HP-UX) that you are working in. (b) You have exceeded some physical disk space limit.
ACTION Clean up your RL or use a different file for the object. --------------------------------------------------------------------------------------5383 MESSAGE FILE ! HAS AN INVALID RECORD SIZE. EXPECTED 128W RECORDS. (5383) CT CAUSE The RL has an invalid record size. ACTION Build a new RL file with a correct record size. --------------------------------------------------------------------------------------5400 to 5999 MESSAGE INTERNAL COMPILER ERROR. I CAUSE The compiler is in error.
this message. ACTION Use the $OPTIMIZE 'BASIC_BLOCKS num $ compiler option. --------------------------------------------------------------------------------------6110 to 6199 MESSAGE INTERNAL OPTIMIZER ERROR. CT CAUSE The compiler is in error. ACTION Report error to your HP Service Representative. --------------------------------------------------------------------------------------6200 to 6299 MESSAGE ALIASER: OUT OF MEMORY. CT CAUSE The optimizer ran out of virtual memory.
6309 MESSAGE RALLOC: OUT OF CALLER FLOATING POINT REGISTERS. (6309) CT CAUSE Floating point expression too complex. ACTION Simplify floating point expressions. --------------------------------------------------------------------------------------6310 to 6365 MESSAGE OUT OF MEMORY CT CAUSE The optimizer ran out of virtual memory. ACTION The easiest workaround is to break your compilation unit into two or more pieces.
On HP-UX, the following warning will be generated if the file /usr/lib/sched.models cannot be found. --------------------------------------------------------------------------------------7002 MESSAGE CANNOT OPEN /usr/lib/sched.models. (7002) W CAUSE The file /usr/lib/sched.models does not exist or cannot be opened for reading. ACTION Check protections on /usr/lib/sched.models. If it does not exist, contact your HP Service Representative.
CT CAUSE Compiler ran out of virtual memory. ACTION See message 6200. --------------------------------------------------------------------------------------7203 MESSAGE ALLOCATE_BYTES: OUT OF MEMORY. (7203) CT CAUSE Compiler ran out of virtual memory. ACTION See message 6200. --------------------------------------------------------------------------------------7204 MESSAGE ERROR IN WRITING TO OUTPUT FILE. (7204) CT CAUSE I/O error writing to object file.
A-: 80
Appendix B ASCII Character Codes Table B-1 maps each ASCII character to its decimal and hexadecimal code, its ASCII symbol, and its name. Each code is stored in eight bits; thus the decimal codes are between 0 and 255, and the hexadecimal codes are between 0 and FF. Table B-1.
Table B-1.
| | | | | | 32 | 20 | SP | Space | | | | | | -----------------------------------------------------------------------------------------------| | | | | | 33 | 21 | ! | Exclamation mark | | | | | | -----------------------------------------------------------------------------------------------| | | | | | 34 | 22 | " | Quotation mark | | | | | | -----------------------------------------------------------------------------------------------| | | | | | 35 | 23 | # | Number sign | | | | | | ------------------------
| | | | | | 48 | 30 | 0 | Zero | | | | | | -----------------------------------------------------------------------------------------------| | | | | | 49 | 31 | 1 | One | | | | | | -----------------------------------------------------------------------------------------------| | | | | | 50 | 32 | 2 | Two | | | | | | -----------------------------------------------------------------------------------------------| | | | | | 51 | 33 | 3 | Three | | | | | | --------------------------------------------------------
| | | | | | 64 | 40 | @ | Commercial "at" sign | | | | | | -----------------------------------------------------------------------------------------------| | | | | | 65 | 41 | A | Uppercase A | | | | | | -----------------------------------------------------------------------------------------------| | | | | | 66 | 42 | B | Uppercase B | | | | | | -----------------------------------------------------------------------------------------------| | | | | | 67 | 43 | C | Uppercase C | | | | | | ------------------
| | | | | | 80 | 50 | P | Uppercase P | | | | | | -----------------------------------------------------------------------------------------------| | | | | | 81 | 51 | Q | Uppercase Q | | | | | | -----------------------------------------------------------------------------------------------| | | | | | 82 | 52 | R | Uppercase R | | | | | | -----------------------------------------------------------------------------------------------| | | | | | 83 | 53 | S | Uppercase S | | | | | | ---------------------------
Table B-1.
-----------------------------------------------------------------------------------------------| | | | | | 116 | 74 | t | Lowercase t | | | | | | -----------------------------------------------------------------------------------------------| | | | | | 117 | 75 | u | Lowercase u | | | | | | -----------------------------------------------------------------------------------------------| | | | | | 118 | 76 | v | Lowercase v | | | | | | --------------------------------------------------------------------------
Appendix C Compiler Limits and Values These compiler limits are maximum values that you cannot change: Number of: Maximum Value Bits per structure 2147483600 Characters per identifier 132 Characters per source line 132 Characters per string 268435447 Elements per array 268435455 Elements per enumerated type 17367 Elements per set 2147483616 Nested IF options * 12 Nested INCLUDE options * Operating system dependent Nested PUSH options * 15 Nested TRY-RECOVER constructs 30 * If a prog
C-: 2