[an error occurred while processing this directive]
HP OpenVMS Systems Documentation |
HP Pascal for OpenVMS
|
Previous | Contents | Index |
An identifier is a combination of letters, digits, dollar signs ($), and underscores (_) that conforms to the following restrictions:
On OpenVMS systems, HP Pascal uses uppercase characters for all external user symbols.
You can provide a string argument to the GLOBAL, WEAK_GLOBAL, EXTERNAL, and WEAK_EXTERNAL attributes to override this case usage. HP Pascal passes the string unmodified to the linker.
This manual shows predeclared identifiers in uppercase letters. If you choose, you can express them in mixed case or lowercase in your programs. The following examples show valid and invalid identifiers:
For2n8 MAX_WORDS upto LOGICAL_NAME_TABLE {Unique in first} Logical_Name_Scanner { 31 characters} SYS$CREMBX |
4Awhile {Starts with a digit} up&to {Contains an ampersand} YEAR_END_87_MASTER_FILE_TOTAL_DISCOUNT {Not unique in first} Year_End_87_Master_File_Total_Dollars { 31 characters} |
Table 1-5 presents the HP Pascal predeclared identifiers that name data types, symbolic constants, file variables, procedures, and functions. You can redefine a predeclared identifier, but if you do, the original declaration becomes unavailable within the block in which you redeclared the word.
ABS | ADD_ATOMIC | ADD_INTERLOCKED | ADDRESS |
AND_ATOMIC | ARCTAN | ARGC | ARGUMENT |
ARGUMENT_LIST_LENGTH | ARGV | ASSERT | |
BARRIER | BIN | BIT_OFFSET | BITNEXT |
BITSIZE | BOOLEAN | BYTE_OFFSET | |
CARD | CARDINAL | CARDINAL16 | CARDINAL32 |
CHAR | CHR | CLEAR_INTERLOCKED | CLOCK |
C_STR | C_STR_T | CLOSE | COS |
CREATE_DIRECTORY | |||
D_FLOAT | DATE | DBLE | DEC |
DELETE | DELETE_FILE | DISPOSE | DOUBLE |
EOF | EOLN | EPSDOUBLE | EPSQUADRUPLE |
EPSREAL | EQ | ESTABLISH | EXP |
EXPO | EXTEND | ||
F_FLOAT | FALSE | FIND | FIND_FIRST_BIT_CLEAR |
FIND_FIRST_BIT_SET | FIND_MEMBER | FIND_NONMEMBER | FINDK |
G_FLOAT | GE | GET | GETTIMESTAMP |
GT | |||
H_FLOAT | HALT | HEX | |
IADDRESS | IADDRESS64 | INDEX | INPUT |
INT | INTEGER | INTEGER8 | INTEGER16 |
INTEGER32 | INTEGER64 | INTEGER_ADDRESS | |
LE | LENGTH | LINELIMIT | LN |
LOCATE | LOWER | LSHIFT | LT |
MALLOC_C_STR | MAX | MAXCHAR | MAXDOUBLE |
MAXINT | MAXQUADRUPLE | MAXREAL | MAXUNSIGNED |
MIN | MINDOUBLE | MINQUADRUPLE | MINREAL |
NE | NEW | NEXT | NIL |
OCT | ODD | OPEN | OR_ATOMIC |
ORD | OUTPUT | ||
PACK | PAD | PAGE | PAS_STR |
PAS_STRCPY | POINTER | PRED | PRESENT |
PUT | |||
QUAD | QUADRUPLE | ||
RANDOM | READ | READLN | READV |
REAL | RENAME_FILE | RESET | RESETK |
REVERT | REWRITE | ROUND | ROUND64 |
RSHIFT | |||
S_FLOAT | SEED | SET_INTERLOCKED | SIN |
SINGLE | SIZE | SNGL | SQR |
SQRT | STATUS | STATUSV | STRING |
SUBSTR | SUCC | SYSCLOCK | |
T_FLOAT | TEXT | TIME | TIMESTAMP |
TRUE | TRUNC | TRUNC64 | TRUNCATE |
UAND | UDEC | UFB | UINT |
UNDEFINED | UNLOCK | UNOT | UNPACK |
UNSIGNED | UNSIGNED8 | UNSIGNED16 | UNSIGNED32 |
UNSIGNED64 | UOR | UPDATE | UPPER |
UROUND | UROUND64 | UTRUNC | UTRUNC64 |
UXOR | |||
WALLCLOCK | WRITE | WRITELN | WRITEV |
X_FLOAT | XOR | ||
ZERO |
This table does not include predefined identifiers that are only provided by HP Pascal for compatibility with other Pascal compilers. |
Comments document the actions or elements of a program. The text of a comment can contain any ASCII character except a nonprinting control character, such as an ESCAPE character. You can place comments anywhere in a program that white space can appear.
You signify a comment with braces or with a parenthesis and asterisk pair, as follows:
{ This is a comment. } (* This is a comment, too. *) |
HP Pascal allows you to mix the two symbol pairs in one comment, as follows:
{ The delimiters of this comment do not match. *) (* HP Pascal allows you to mix delimiters in this way. } |
HP Pascal does not allow you to nest comments. The following example causes a compile-time error because the comment ends at the first closing delimiter (}).
(* Cannot { nest comments inside } of comments like this *) |
The %IF directive can be used to essentially comment out large sections of code as follows:
%IF FALSE %THEN ...code to disable... %ENDIF |
For more information on %IF, see Section 11.4.
HP Pascal allows for an end-of-line comment using an exclamation point (!). If an exclamation point is encountered on a line in the source program, the remainder of that line will be treated as a comment.
This comment syntax is not recognized by SCA for report generation.
A page break or form-feed character can appear anywhere in your program except on a line with text surrounding the form feed. For example, the following lines are legal:
[FF] %TITLE 'Variable Declarations' end; [FF] [FF] [FF] VAR [FF] |
However, the following line generates an error:
BEGIN [FF] END |
The page break does not affect the meaning of the program, but causes a page to eject at the corresponding line in a listing file.
Every piece of data that is created or manipulated by an HP Pascal program has a data type. The data type determines the range of values, set of valid operations, and maximum storage allocation for each piece of data.
This chapter describes the following topics:
This section describes the ordinal types that are predefined by HP Pascal and user-defined ordinal types (types that require you to provide identifiers or boundary values to completely define the data type).
The ranges of values for these types are ordinal in nature; the values
are ordered so that each has a unique ordinal value indicating its
position in a list of all the values of that type. There is a
one-to-one correspondence between the values in an ordinal type and the
set of positive integers.
2.1.1 Integer Types
HP Pascal makes available the INTEGER,
INTEGER64,
UNSIGNED,
UNSIGNED64,
and
INTEGER_ADDRESS
predeclared types. These data types are described in Section 2.1.1.1,
Section 2.1.1.2, and Section 2.1.1.4, respectively.
2.1.1.1 INTEGER and INTEGER64 Types
HP Pascal provides the INTEGER and INTEGER64 (not available on all systems) integer types. Also provided are the INTEGER8, INTEGER16, and INTEGER32 types, which are used as synonyms for subranges of the INTEGER type.
The range of the integer values consists of positive and negative integer values, and of the value 0. The range boundaries depend on the architecture of the machine you are using.
Table 2-1 lists the storage sizes and ranges of values for these signed ordinal types.
Data Type | Size | Range |
---|---|---|
INTEGER8 | 8 bits |
-128..127
16#80..16#7F |
INTEGER16 | 16 bits |
-32768..32767
16#8000..16#7FFF |
INTEGER32 | 32 bits |
-2147483648..2147483647
16#80000000..16#7FFFFFFF |
INTEGER64 | 64 bits |
-9223372036854775808..9223372036854775807
16#8000000000000000..16#7FFFFFFFFFFFFFFF |
The largest possible value of the INTEGER64 type is represented by the predefined constant MAXINT64. The smallest possible value of the INTEGER64 type is represented by the value of the expression -MAXINT64. While the value of -MAXINT64-1 can also be represented, correct results may not be produced in certain expressions.
The largest possible value of the INTEGER type is represented by the predefined constant MAXINT. The smallest possible value of the INTEGER type is represented by the value of the expression -MAXINT. While the value -MAXINT-1 can also be represented, it may not produce correct results in certain expressions.
Table 2-2 lists the sizes and the corresponding values of MAXINT and MAXINT64.
Constant | Size | Value | |
---|---|---|---|
MAXINT | 32 bits | (2 31)-1 | 16#7FFFFFFF |
MAXINT64 | 64 bits | (2 63)-1 | 16#7FFFFFFFFFFFFFFF |
HP Pascal provides the UNSIGNED and UNSIGNED64 types (not available on all systems). Also provided are the UNSIGNED32, CARDINAL, CARDINAL16, and CARDINAL32 types, which are used as synonyms for subranges of the UNSIGNED type. UNSIGNED8 and UNSIGNED16 are provided as synonyms for subranges of INTEGER with positive values that correspond to an UNSIGNED subrange of the same size. The range of unsigned values consists of nonnegative integer values.
The unsigned data types are HP Pascal extensions that are provided to facilitate systems programming using certain operating systems. Given that these data types are not standard, you should not use them for every application involving nonnegative integers.
Table 2-3 lists the range of values for unsigned numbers.
Data Type | Size | Range |
---|---|---|
UNSIGNED8 | 8 bits |
0..255
0..16#FF |
UNSIGNED16, CARDINAL16 | 16 bits |
0..65535 ( 2
16 -1)
0..16#FFFF |
UNSIGNED32, CARDINAL32 | 32 bits |
0..4294967295 (2
32)-1
0..16#FFFFFFFF |
UNSIGNED64 | 64 bits |
0..18446744073709551615 ( 2
64 -1)
0..16#FFFFFFFFFFFFFFFF |
The largest possible value of the UNSIGNED64 type is represented by the predefined constant MAXUNSIGNED64. The smallest possible value of the UNSIGNED64 type is 0.
Table 2-4 lists the sizes and the corresponding values of MAXUNSIGNED and MAXUNSIGNED64.
Constant | Size | Value | |
---|---|---|---|
MAXUNSIGNED | 32 bits | (2 32)-1 | 16#FFFFFFFF |
MAXUNSIGNED64 | 64 bits | (2 64)-1 | 16#FFFFFFFFFFFFFFFF |
Previous | Next | Contents | Index |