5. Embedded QUEL for Ada : Ada Variables and Data Types : Variable and Type Declarations : Integer Type Definitions
 
Share this page                  
Integer Type Definitions
The syntax of an EQUEL/Ada integer type definition is:
range lower_bound .. upper_bound
In the context of a type declaration, the syntax is:
type identifier is range lower_bound .. upper_bound;
In the context of a subtype declaration, the syntax is:
subtype identifier is integer_type_name
               range lower_bound .. upper_bound;
Syntax Notes:
1. In an integer type declaration (not a subtype declaration), the range constraint of an integer type definition is processed by EQUEL to evaluate storage size information. Both lower_bound and upper_bound must be integer literals. Based on the specified range and the actual values of the bounds, EQUEL treats the type as a byte-size, a word-size, or a longword-size integer. For example:
## type Table_Num is range 1..200;
2. In an integer subtype declaration, the range constraint is
treated as a variable range constraint and is not processed. Consequently, the same rules that apply to range constraints for variable declarations apply to integer range constraints for integer subtype declarations. The base type and storage size information is determined from the integer_type_name used. For example:
## subtype Ingres_I1 is Integer range -128..127;
## subtype Ingres_I2 is Integer range -32768..32767;
## subtype Table_Low is Table_Num range 1..10;
## subtype Null_Ind  is Short_Integer range -1..0;   -- Null Indicator