HP 3000 Manuals

Type Definition [ HP Pascal/iX Reference Manual ] MPE/iX 5.0 Documentation


HP Pascal/iX Reference Manual

Type Definition 

A TYPE section introduces the name and set of values for a user-defined
type.  HP Pascal requires that a type identifier be defined before its
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.  The
identifier may then appear in subsequent type or constant definitions or
in variable declarations.

The reserved word TYPE precedes one or more type definitions.  A type 
definition consists of an identifier, the equals sign (=), and a type.

A data type determines a set of attributes that includes the following:

   *   The set of permissible values.

   *   The set of permissible operations.

   *   The amount of storage required.

The three most general categories of data type are simple, structured,
and pointer.

Simple data types are the types ordinal, real, or longreal.  Ordinal
types include the standard types integer, char, bit16, bit32, bit52,
shortint, longint, and boolean as well as user-defined enumerated and
subrange types.

Structured data types are the types array, record, set, and file.  The
standard type string is also a structured data type.  The standard type
text is a variant of the file type.

Pointer data types define pointer variables that point to dynamically
allocated variables on the heap.  For a detailed description of HP Pascal
data types, refer to Chapter 3 .

CONST, TYPE, VAR, MODULE, and IMPORT sections may be intermixed.

Syntax 

     Type_decl:

[]
Example TYPE units = (inches,feet,miles); { Simple type } files = ARRAY [1..10] OF text; { Structured type } PTR1 = ^units; { Pointer type }


MPE/iX 5.0 Documentation