[an error occurred while processing this directive]

HP OpenVMS Systems Documentation

Content starts here

HP Pascal for OpenVMS
Language Reference Manual


Previous Contents Index

A.3.2.3 D_floating-Point Numbers

A D_floating-point value is represented by eight contiguous bytes. The bits are numbered from the right, 0 through 63, as shown in Figure A-4.

Figure A-4 D_floating-Point Data Representation


A D_floating-point value is specified by its address A, the address of the byte containing bit 0. The form of this value is identical to that of a F_floating-point value except for an additional 32 low-significance fraction bits. Within the fraction, bits of increasing significance are numbered 48 through 63, 32 through 47, 16 through 31, and 0 through 6.

For More Information:

A.3.2.4 G_floating-Point Numbers

A G_floating-point value is represented by eight contiguous bytes. The bits are numbered from the right, 0 through 63, as shown in Figure A-5.

Figure A-5 G_floating-Point Data Representation


A G_floating-point value is specified by its address A, the address of the byte containing bit 0. The form of this value is sign magnitude as follows:

  • Bit 15 is the sign bit.
  • Bits 14 through 4 are an excess 1024 binary exponent.
  • Bits 3 through 0 and 63 through 16 represent a normalized 53-bit fraction without the redundant most significant fraction bit. Within the fraction, bits of increasing significance go from 48 through 63, 32 through 47, 16 through 31, and 0 through 3.

For More Information:

A.3.2.5 T_floating-Point Numbers

A T_floating-point value is represented by 8 contiguous bytes. The bits are numbered from the right 0 through 63, as shown in Figure A-6.

Figure A-6 T_floating-Point Data Representation


A T_floating-point value is specified by its address A, the address of the byte containing bit 0. The form of this value is sign magnitude as follows:

  • Bit 63 is the sign bit (0 for positive numbers, 1 for negative numbers).
  • Bits 62 through 52 are an excess 127 exponent.
  • Bits 51 through 0 are a normalized 53-bit fraction with the redundant most significant fraction bit not represented.

For More Information:

A.3.2.6 H_floating-Point Numbers

An H_floating-point value is represented by 16 contiguous bytes. The bits are numbered from the right 0 through 127, as shown in Figure A-7.

Figure A-7 H_floating-Point Data Representation


An H_floating-point value is specified by its address A, the address of the byte containing bit 0. The form of this value is sign magnitude as follows:

  • Bit 15 is the sign bit.
  • Bits 14 through 0 are an excess 16,384 binary exponent.
  • Bits 127 through 16 are a normalized 113-bit fraction with the redundant most significant fraction bit not represented. Within the fraction, bits of increasing significance go from 112 through 127, 96 through 111, 80 through 95, 64 through 79, 48 through 63, 32 through 47, and 16 through 31.

For More Information:

A.3.2.7 X_floating-Point Numbers

An X_floating-point value is represented by 16 contiguous bytes. The bits are numbered from the right 0 through 127, as shown in Figure A-8.

Figure A-8 X_floating-Point Data Representation


An X_floating-point value is specified by its address A, the address of the byte containing bit 0. The form of this value is sign magnitude as follows:

  • Bit 127 is the sign bit.
  • Bits 112 through 126 are an excess 16,383 binary exponent.
  • Bits 0 through 111 are a normalized 112-bit fraction with the redundant most significant fraction bit not represented.

For More Information:

A.3.3 Representation of Nonstatic Types and Variables

This section describes the representation of nonstatic types and variables.

A.3.3.1 Representation of Nonstatic Types

Each nonstatic data type has some storage associated with it, called the control part. Figure A-9 shows the layout of a control part of a nonstatic data type.

Figure A-9 Storage of Nonstatic Data Types


In the top portion of the control part, HP Pascal stores each actual discriminant of the schema type in a longword of storage. The additional information piece of the control part varies in content and size depending on the type specification, and can contain any of the following:

  • No information (if the schema type is simple), as follows:


    TYPE
       A_Char( x,y : CHAR ) = x..y;
    
  • Control parts of nested discriminated schema types, as follows:


    TYPE
       My_Record( a, b : INTEGER ) = RECORD
          f1 : STRING( a );
          f2 : STRING( b );
          END;
    
  • Values for all expressions appearing in the type definition, as follows:


    TYPE
       My_Subrange( a, b : INTEGER ) = a..a+b;
    
    

    HP Pascal evaluates the expression a+b when the schema type is discriminated and saves the result in the control part.
  • The total size of the data part, if it can vary based on actual discriminants, as follows:


    TYPE
       Arr( a, b : INTEGER ) = ARRAY[a..b] OF REAL;
    
    

Note

The order of information and the content of the additional information section of the control part cannot be guaranteed.

If you declare more than one variable of a discriminated schema type, each variable shares the information in the control part for that type.

A.3.3.2 Representation of Variables of Nonstatic Types

When allocating storage for a variable of a nonstatic type, HP Pascal allocates a pointer part and a data part. HP Pascal allocates and initializes the pointer part (to point to the data part); you cannot access the pointer part in your program. HP Pascal associates each object with a control part according to its data type.

If the type of the object involves more than one nonstatic type, HP Pascal associates that object with all applicable control parts. Consider the following example:


TYPE
   Sub_Range( a, b : INTEGER ) = a..b;

VAR  {x requires information in two control parts:}
   x : ARRAY[Sub_Range( i, j ), Sub_Range( k, l )] OF INTEGER;

Figure A-10 shows the layout for an object of a nonstatic type.

Figure A-10 Storage of Variables of Nonstatic Types


In Figure A-10, the pointer part is directly accessible by your program. The data part is allocated in heap when you use the NEW procedure. For example:


TYPE
   dstr = STRING( I );

VAR
   ptr : ^dstr;
{In the executable section:}
NEW( ptr );

You cannot create variables of undiscriminated types, but you can also show the representation for pointers to nonstatic types (except undiscriminated schema).

Figure A-11 shows the layout for a pointer to an undiscriminated schema type.

Figure A-11 Storage of Pointer Variables to Undiscriminated Schema Types


In Figure A-11, the control part and data part are allocated together by a call to the NEW procedure. Each object allocated this way has its own control part since the base type of the pointer is undiscriminated and does not have a control part. Consider the following example:


VAR
   x, y, z : ^STRING;
{In the executable section:}
NEW( x, 10 );   {x has a control and data part}
y := x;         {y points to same control and data part as x}
NEW( z, 10 );   {z has separate control and data parts}

Each variable created by NEW contains a unique control part attached to the data part.

A.3.3.3 Representation of Nonstatic Record Fields

If a record object contains a field of a nonstatic type, HP Pascal stores the field in one piece of storage within the record's storage (HP Pascal does not create a pointer part and a data part). HP Pascal determines the offset of the object by accessing the information in the control part of the field's data type and information in the control part of the record.


Appendix B
Summary of HP Pascal Extensions

If you need to write portable code, you should not use the language features that are HP Pascal extensions. The following sections provide information on HP Pascal extensions:

  • Extensions to the unextended Pascal standards ( Section B.1)
  • Extensions to the Extended Pascal standard ( Section B.2)

For More Information:

B.1 HP Pascal Extensions to Unextended Pascal

Table B-1 summarizes the language features provided in HP Pascal that are not part of the unextended Pascal language definitions.

Table B-1 HP Pascal Extensions to Unextended Pascal
Category Extension
Lexical and
syntactical
extensions
Reserved words: BREAK, CONTINUE, ERR, EXIT, MODULE, NEXT, OTHERWISE, REM, RETURN, VALUE, VARYING, %DESCR, %STDESCR, %IMMED, %REF, %INCLUDE, %TITLE, %SUBTITLE, %DICTIONARY, %IF, %ELIF, %ENDIF, %DEFINED, %ERROR, %WARN, %INFO, %MESSAGE, %ARCH_NAME, %SYSTEM_NAME, %SYSTEM_VERSION, %DATE, %TIME, %COMPILER_VERSION, %LINE, %FILE, %ROUTINE, %MODULE, %IDENT
  Exponentiation operator (**)
  REM operator
  AND_THEN and OR_ELSE operators
  NOT IN operator
  Type cast operator (::) for variables and expressions
  Double quotation marks as string and character delimiters
  Escape sequences within double quotation marks
  %radix-specifier for binary, hexadecimal, and octal notation for integers, (#) radix-specifier for integers in bases 2 to 36 inclusive
  Double- and quadruple-precision real numbers
  Dollar sign ($) and underscore (_) characters in identifiers
  Identifiers that can begin with the dollar sign or underscore characters
  Alphanumeric strings for labels
  Extended syntax for inclusion of nonprinting characters in single-quoted character strings
  Compile-time constant expressions allowed anywhere a constant is allowed
  Constructors of structured types used anywhere in place of a constant of the structured type
  Attributes used with data items, routines, and compilation units
  Relaxed rules for assignment compatibility
  Structural compatibility enforced between actual and formal parameters
  ! for end-of-line comments
Predefined types ALFA, CARDINAL, CARDINAL16, C_STR_T, INTEGER_ADDRESS, CARDINAL32, INTEGER8, INTEGER16, INTEGER32, INTEGER64, INTSET, POINTER, UNIV_PTR, UNSIGNED8, UNSIGNED16, UNSIGNED32, UNSIGNED64, SINGLE (F_floating and S_floating), DOUBLE (D_floating, G_floating, and T_floating), QUADRUPLE (H_floating and X_floating), STRING, TIMESTAMP
  VARYING OF CHAR structured type and concatenation operator for all strings
Predeclared
procedures
ARGV, ASSERT, BARRIER, CLOSE, CREATE_DIRECTORY, DATE, DELETE, DELETE_FILE, ESTABLISH, EXTEND, FIND, FINDK, GETTIMESTAMP, HALT, LINELIMIT, LOCATE, OPEN, READV, REMOVE, RENAME_FILE, RESETK, REVERT, STLIMIT, TIME, TRUNCATE, UNLOCK, UPDATE, WRITEV GETTIMESTAMP
Predeclared
functions
Transfer functions: DBLE, INT, INT64, QUAD, ROUND64, SNGL, TRUNC, TRUNC64, UINT, UINT64, UROUND, UROUND64, UTRUNC, UTRUNC64
  Implicitly declared type-conversion and type-casting routines for predefined data types
  Dynamic allocation function: ADDR, ADDRESS, IADDRESS, IADDRESS64
  Character-string functions: BIN, DEC, HEX, INDEX, LENGTH, OCT, PAD, STATUSV, SUBSTR, UDEC, GT, GE, LT, LG, EQ, NE
  Parameter functions: ARGUMENT, ARGUMENT_LIST_LENGTH, PRESENT
  Privileged routines: MFPR, MTPR
  Arithmetic functions: BITAND, BITNOT, BITOR, BITXOR, LSHFT, LSHIFT, MIN, MAX, RANDOM, RSHFT, RSHIFT, SEED, UAND, UNOT, UOR, UXOR, XOR
  Allocation size functions: SIZE, SIZEOF, NEXT, BITSIZE, BITNEXT
  Ordered sequence of values functions: FIRST, FIRSTOF, HBOUND, IN_RANGE, LAST, LASTOF, LBOUND
  Low-level interlocked functions: ADD_ATOMIC, ADD_INTERLOCKED, AND_ATOMIC, CLEAR_INTERLOCKED, FIND_FIRST_BIT_CLEAR, FIND_FIRST_BIT_SET, FIND_MEMBER, FIND_NONMEMBER, OR_ATOMIC, SET_INTERLOCKED
  Null-terminated string functions: C_STR, MALLOC_C_STR, PAS_STR, PAS_STRCPY
  I/O functions: STATUS, UFB
  Field position functions: BIT_OFFSET, BYTE_OFFSET
  Additional functions: ARGC, CARD, CLOCK, EXPO, UNDEFINED, ZERO, DATE, TIME, UPPER, LOWER, SYSCLOCK, WALLCLOCK
READ, READLN,
WRITE, WRITELN
extensions
Parameters of character-string and enumerated types for READ and READLN

Parameters of enumerated types for WRITE and WRITELN

Prompting at the terminal with a WRITE/READ orWRITE/READLN sequence

Optional carriage-control specification for text files with WRITE and WRITELN

Optional radix specification for READ and READLN

Optional radix specification for WRITE and WRITELN

Extended I/O capabilities Direct access and relative file organization

Keyed access and indexed file organization

Optional second parameter to RESET, REWRITE, and EXTEND for specifying a file name

Declarations Declaration and definition sections that can appear more than once and in any order
  Initialization of variables, types, and record fields in VAR and TYPE sections of any program, module, procedure, or function
  Schema types
  VALUE initialization section
  OTHERWISE clause in variant records
  Ranges in variant label lists
Statements OTHERWISE clause in CASE statement
  Ranges in CASE label lists
  BREAK, CONTINUE, EXIT, NEXT, and RETURN statements
  FOR statement with SET iterations
Procedures and
functions
Functions that return values of structured types (other than file types)
  Functions called as procedures
  External procedure and function declarations
  Default values for formal parameters
  Nonpositional parameter passing
  Extended mechanism specifiers and parameter-passing attributes for passing parameters to external procedures and functions: %IMMED, %REF, %DESCR, %STDESCR, IMMEDIATE, REFERENCE, CLASS_S, CLASS_A, CLASS_NCA
Compilation MODULE capability for combining declarations and definitions to be compiled independently from the main program
  ENVIRONMENT and INHERIT attributes to control independent compilation
  Module initialization and finalization

B.2 HP Pascal Extensions to Extended Pascal

Table B-2 summarizes the language features provided in HP Pascal that are not part of the Extended Pascal language definitions.

Table B-2 HP Pascal Extensions to Extended Pascal
Category Extension
Lexical and
syntactical
extensions
Reserved words: BREAK, CONTINUE, ERR, EXIT, NEXT, REM, RETURN, VARYING, %DESCR, %STDESCR, %IMMED, %REF, %INCLUDE, %TITLE, %SUBTITLE, %DICTIONARY, %DICTIONARY, %IF, %ELIF, %ENDIF, %DEFINED, %ERROR, %WARN, %INFO, %MESSAGE, %ARCH_NAME, %SYSTEM_NAME, %SYSTEM_VERSION, %DATE, %TIME, %COMPILER_VERSION, %LINE, %FILE, %ROUTINE, %MODULE, %IDENT
  REM operator
  NOT IN operator
  Type cast operator (::) for variables and expressions
  "%radix-specifier number" form for binary, hexadecimal, and octal notation for integers
  Alphanumeric strings for labels
  Double- and quadruple-precision real numbers
  Identifiers can contain the dollar sign ($) character
  Identifiers can begin with the dollar sign character and the underscore character
  Double quotation marks as string and character delimiters
  Escape sequences within double quotation marks
  Labels can be alphanumeric strings
  Extended syntax for inclusion of nonprinting characters in single-quoted character strings
  Parenthetical form ((constructor)) for constructors of structured types, used anywhere in place of a constant of the structured type
  Attributes
  Relaxed rules for assignment compatibility
  Structural compatibility enforced between actual and formal parameters
  ! for end-of-line comments
Predefined types ALFA, C_STR_T, CARDINAL, CARDINAL16, CARDINAL32, INTEGER8, INTEGER16, INTEGER32, INTEGER64, INTSET, POINTER, UNIV_PTR, UNSIGNED8, UNSIGNED16, UNSIGNED32, UNSIGNED64, SINGLE (F_floating and S_floating), DOUBLE (D_floating, G_floating, and T_floating), QUADRUPLE (H_floating and X_floating)
  VARYING OF CHAR structured type and concatenation operator for all strings
Predeclared
procedures
ARGV, ASSERT, BARRIER, CLOSE, CREATE_DIRECTORY, DATE, DELETE, DELETE_FILE, ESTABLISH, FIND, FINDK, LINELIMIT, LOCATE, NULL, OPEN, READV, REMOVE, RENAME_FILE, RESETK, REVERT, STLIMIT, TIME, TRUNCATE, UNLOCK, UPDATE, WRITEV
Predeclared
functions
Transfer functions: DBLE, INT, INT64, QUAD, ROUND64, SNGL, TRUNC, TRUNC64, UINT, UINT64, UROUND, UROUND64, UTRUNC, UTRUNC64
  Implicitly declared type-conversion and type-casting routines for predefined data types
  Dynamic allocation function: ADDR, ADDRESS, IADDRESS, IADDRESS64
  Character-string functions: BIN, DEC, HEX, OCT, PAD, STATUSV, UDEC
  Parameter functions: ARGUMENT, ARGUMENT_LIST_LENGTH, PRESENT
  Arithmetic functions: BITAND, BITNOT, BITOR, BITXOR, LSHFT, LSHIFT, RANDOM, RSHFT, RSHIFT, SEED, UAND, UNOT, UOR, UXOR, XOR, MIN, MAX
  Allocation size functions: SIZE, SIZEOF, NEXT, BITSIZE, BITNEXT
  Ordered sequence of values functions: FIRST, FIRSTOF, HBOUND, IN_RANGE, LAST, LASTOF, LBOUND
  Low-level interlocked functions: ADD_ATOMIC, ADD_INTERLOCKED, AND_ATOMIC, CLEAR_INTERLOCKED, FIND_FIRST_BIT_CLEAR, FIND_FIRST_BIT_SET, FIND_MEMBER, FIND_NONMEMBER, OR_ATOMIC, SET_INTERLOCKED
  Privileged routines: MTPR, MFPR
  I/O functions: STATUS, UFB
  Null-terminated string functions: C_STR, MALLOC_C_STR, PAS_STR, PAS_STRCPY
  Field position functions: BIT_OFFSET, BYTE_OFFSET
  Additional predeclared functions: ARGC, CLOCK, EXPO, LOWER, SYSCLOCK, UNDEFINED, UPPER, WALLCLOCK, ZERO
READ, READLN,
WRITE, WRITELN
extensions
Parameters of enumerated types for READ and READLN

Parameters of enumerated types for WRITE and WRITELN

Prompting at the terminal with a WRITE/READ orWRITE/READLN sequence

Optional carriage-control specification for text files with WRITE and WRITELN

Optional radix specification for READ and READLN

Optional radix specification for WRITE and WRITELN

Extended I/O capabilities Direct access and relative file organization

Keyed access and indexed file organization

Optional second parameter to RESET, REWRITE, and EXTEND for specifying a file name

Declarations VALUE initialization section
Statements BREAK, CONTINUE, EXIT, NEXT, and RETURN statements
Procedures and functions Functions called as procedures

External procedure and function declarations

Default values for formal parameters

Nonpositional parameter passing

Extended mechanism specifiers and parameter-passing attributes for passing parameters to external procedures and functions: %IMMED, %REF, %DESCR, %STDESCR, IMMEDIATE, REFERENCE, CLASS_S, CLASS_A, CLASS_NCA

Compilation MODULE syntax differs from the syntax provided by Extended Pascal
  ENVIRONMENT and INHERIT attributes to control independent compilation


Previous Next Contents Index