Language Change Specification for Extended Ranges / Operations on Ranges

LCS Number: LCS-2016-099
Version: 7
Date: 21-Mar-2017
Status: Approved
Author: Patrick Lehmann
Lieven Lemiengre
Source Doc: Extended Ranges
Operations on Ranges
More: Proposal
Examples
LCS History
Summary: Allow operations on ranges by introducing a range_record.

Style Notes

Changes are shown in red font.
Deletions are crossed out.
Editing or reviewing notes in green font.

Details of Language Change

5.2.1 General

Scalar types consist of enumeration types, integer types, physical types, and floating-point types. Enumeration types and integer
types are called discrete types. Integer types, floating-point types, and physical types are called numeric types. All scalar types
are ordered; that is, all relational operators are predefined for their values. Each value of a discrete or physical type has a position
number that is an integer value.

[...]

range_constraint ::= range range

range ::=
    range_attribute_name
  | simple_range simple_expression direction simple_expression
  | range_expression

simple_range ::= simple_expression direction simple_expression

direction ::= to | downto

[...]

For values of discrete or physical types, a value V1 is said to be to the left of a value V2 within a given range if both V1 and V2 belong
to the range and either the range is an ascending range and V2 is the successor of V1, or the range is a descending range and V2 is the
predecessor of V1. A list of values of a given range is in left to right order if each value in the list is to the left of the next value in
the list within that range, except for the last value in the list.

Any scalar type defines an implicit record type, called range record, which represents the range of that scalar type (see 5.3.3.2).
A range record is said to correspond to a type or subtype T and vise versa, if the type of the range record bounds matches T.

For a range expression, it's an error if the expression result type is not a range record.

If a range constraint is used in a subtype indication, the type of the expressions (likewise, of the bounds of a range attribute) shall be the
same as the base type of the type mark of the subtype indication. A range constraint is compatible with a subtype if each bound of the range
belongs to the subtype or if the range constraint defines a null range. Otherwise, the range constraint is not compatible with the subtype.

[...]

5.2.2.2 Predefined enumeration types

The predefined enumeration types are CHARACTER, BIT, BOOLEAN, SEVERITY_LEVEL, DIRECTION, and FILE_OPEN_STATUS.

The predefined type CHARACTER is a character type whose values are the 256 characters of the ISO/IEC 8859-1 character set. Each of the 191 graphic
characters of this character set is denoted by the corresponding character literal.

The declarations of the predefined types CHARACTER, BIT, BOOLEAN, SEVERITY_LEVEL, DIRECTION, and FILE_OPEN_STATUS appear
in package STANDARD in Clause 16.

[...]

5.3.2.1 General [Editor note: EBNF style fixes]

[Review note: To follow the chain of EBNF rules] [...]

array_type_definition ::=
    unbounded_array_definition | constrained_array_definition
  | constrained_array_definition

unbounded_array_definition ::=
  array ( index_subtype_definition { , index_subtype_definition } )
    of element_subtype_indication

constrained_array_definition ::=
  array index_constraint of element_subtype_indication
    of element_subtype_indication

index_subtype_definition ::= type_mark range <>

array_constraint ::=
    index_constraint [ array_element_constraint ]
  | ( open ) [ array_element_constraint ]

array_element_constraint ::= element_constraint

index_constraint ::= ( discrete_range { , discrete_range } )

discrete_range ::= discrete_subtype_indication | range
    discrete_subtype_indication
  | range

5.3.2.2 Index constraints and discrete ranges [Reviewer note: to understand discrete ranges]

An index constraint determines the index range for every index of an array type and, thereby, the corresponding array bounds.

For a discrete range used in a constrained array definition and defined by a range, an implicit conversion to the predefined type INTEGER is assumed
if the type of both bounds (prior to the implicit conversion) is the type universal_integer. Otherwise, the type of the range shall be determined by
applying the rules of 12.5 to the range, considered as a complete context, using the rules that the type shall be discrete and that both bounds shall
have the same type.
These rules apply also to a discrete range used in a loop parameter specification (see 10.10) or a generate parameter specification
(see 11.8).

[...]

5.3.3.1 General [NEW; Insert this new section headline between "5.3.3 Record types" and "A record type ..."]

[...]

5.3.3.2 Predefined record types [NEW]

Any scalar type T defines an implicit record type consisting of three elements: Left, Right and Direction. This record is called
a range record. The elements Left and Right are of type T. The element Direction is of enumeration type DIRECTION.

The following incomplete record declaration shall be the template for each predefined range record:


type <unnamed_range_record> is record
  Left      : <scalar_type>;
  Right     : <scalar_type>;
  Direction : DIRECTION;
end record;

14.4.2.4 Subtype declarations

Elaboration of a subtype declaration consists of the elaboration of the subtype indication. The elaboration of a subtype indication creates a subtype. If the
subtype does not include a constraint, then the subtype is the same as that denoted by the type mark. The elaboration of a subtype indication that includes a
constraint proceeds as follows:
  1. The constraint is first elaborated.
  2. A check is then made that the constraint is compatible with the type or subtype denoted by the type mark (see 5.2.1, 5.3.2.2, and 5.3.3).

Elaboration of a range constraint consists of the evaluation of the range. The evaluation of a range consists either of the elaboration of a simple range or
of a range expression.
The evaluation of a simple range defines the bounds and direction of the range. The evaluation of a range expression
consists of the evaluation of the expression. The elements of a range record define the bounds and direction of a range.
Elaboration of an index constraint
consists of the elaboration of each of the discrete ranges in the index constraint in some order that is not defined by the language. Elaboration of an array constraint consists
of the elaboration of the index constraint, if present, and the elaboration of the array element constraint, if present. The order of elaboration of the index constraint and the
array element constraint, if both are present, is not defined by the language. Elaboration of a record constraint consists of the elaboration of each of the record element constraints
in the record constraint in some order that is not defined by the language.

[...]

16.2.6 Predefined attributes of ranges [NEW]

R'RECORD Kind: Type
  Prefix: Any prefix R that is an attribute name and denotes a range.
  Result: The implicitly declared record type of the corresponding range record for the
type of range R.
 
R'VALUE Kind: Value
  Prefix: Any prefix R that is an attribute name and denotes a range.
  Result type: R'RECORD.
  Result: A range record instance of type R'RECORD, wherein each record element is
initialized by the corresponding bounds of R and the element Direction set to
ASCENDING, if R is an ascending range, otherwise to DESCENDING.

16.3 Package STANDARD

package STANDARD is
  -- Predefined enumeration types:
  type DIRECTION is (
    ASCENDING,       -- The range is ascending.
    DESCENDING       -- the range is descending.
  );
  -- The predefined operations for this type are as follows:
  -- function "="(anonymous, anonymous: DIRECTION) return BOOLEAN;
  -- function "/="(anonymous, anonymous: DIRECTION) return BOOLEAN;
  -- function "<"(anonymous, anonymous: DIRECTION) return BOOLEAN;
  -- function "<="(anonymous, anonymous: DIRECTION) return BOOLEAN;
  -- function ">"(anonymous, anonymous: DIRECTION) return BOOLEAN;
  -- function ">="(anonymous, anonymous: DIRECTION) return BOOLEAN;
  -- function MINIMUM (L, R: DIRECTION) return DIRECTION;
  -- function MAXIMUM (L, R: DIRECTION) return DIRECTION;
  -- Implicit defined range record for DIRECTION'RANGE_RECORD:
  -- type DIRECTION_range_record is record
  --   Left      : DIRECTION;
  --   Right     : DIRECTION;
  --   Direction : DIRECTION;
  -- end record;

  type BOOLEAN is (FALSE, TRUE);
  -- The predefined operations for this type are as follows:
  -- function "and"(anonymous, anonymous: BOOLEAN) return BOOLEAN;
  -- function "or"(anonymous, anonymous: BOOLEAN) return BOOLEAN;
  -- function "nand"(anonymous, anonymous: BOOLEAN) return BOOLEAN;
  -- function "nor"(anonymous, anonymous: BOOLEAN) return BOOLEAN;
  -- function "xor"(anonymous, anonymous: BOOLEAN) return BOOLEAN;
  -- function "xnor"(anonymous, anonymous: BOOLEAN) return BOOLEAN;
  -- function "not"(anonymous: BOOLEAN) return BOOLEAN;
  -- function "="(anonymous, anonymous: BOOLEAN) return BOOLEAN;
  -- function "/="(anonymous, anonymous: BOOLEAN) return BOOLEAN;
  -- function "<"(anonymous, anonymous: BOOLEAN) return BOOLEAN;
  -- function "<="(anonymous, anonymous: BOOLEAN) return BOOLEAN;
  -- function ">"(anonymous, anonymous: BOOLEAN) return BOOLEAN;
  -- function ">="(anonymous, anonymous: BOOLEAN) return BOOLEAN;
  -- function MINIMUM(L, R: BOOLEAN) return BOOLEAN;
  -- function MAXIMUM(L, R: BOOLEAN) return BOOLEAN;
  -- function RISING_EDGE(signal S: BOOLEAN) return BOOLEAN;
  -- function FALLING_EDGE(signal S: BOOLEAN) return BOOLEAN;
  -- Implicit defined range record for BOOLEAN'RANGE_RECORD:
  -- type BOOLEAN_range_record is record
  --   Left      : BOOLEAN;
  --   Right     : BOOLEAN;
  --   Direction : DIRECTION;
  -- end record;

  type BIT is ('0', '1');
  -- The predefined operations for this type are as follows:
  -- function "and"(anonymous, anonymous: BIT) return BIT;
  -- function "or"(anonymous, anonymous: BIT) return BIT;
  -- function "nand"(anonymous, anonymous: BIT) return BIT;
  -- function "nor"(anonymous, anonymous: BIT) return BIT;
  -- function "xor"(anonymous, anonymous: BIT) return BIT;
  -- function "xnor"(anonymous, anonymous: BIT) return BIT;
  -- function "not"(anonymous: BIT) return BIT;
  -- function "="(anonymous, anonymous: BIT) return BOOLEAN;
  -- function "/="(anonymous, anonymous: BIT) return BOOLEAN;
  -- function "<"(anonymous, anonymous: BIT) return BOOLEAN;
  -- function "<="(anonymous, anonymous: BIT) return BOOLEAN;
  -- function ">"(anonymous, anonymous: BIT) return BOOLEAN;
  -- function ">="(anonymous, anonymous: BIT) return BOOLEAN;
  -- function "?="(anonymous, anonymous: BIT) return BIT;
  -- function "?/="(anonymous, anonymous: BIT) return BIT;
  -- function "?<"(anonymous, anonymous: BIT) return BIT;
  -- function "?<="(anonymous, anonymous: BIT) return BIT;
  -- function "?>"(anonymous, anonymous: BIT) return BIT;
  -- function "?>="(anonymous, anonymous: BIT) return BIT;
  -- function MINIMUM (L, R: BIT) return BIT;
  -- function MAXIMUM (L, R: BIT) return BIT;
  -- function "??"(anonymous: BIT) return BOOLEAN;
  -- function RISING_EDGE (signal S: BIT) return BOOLEAN;
  -- function FALLING_EDGE (signal S: BIT) return BOOLEAN;
  -- Implicit defined range record for BIT'RANGE_RECORD:
  -- type BIT_range_record is record
  --   Left      : BIT;
  --   Right     : BIT;
  --   Direction : DIRECTION;
  -- end record;
  
  type CHARACTER is (
    NUL,  SOH,  STX,  ETX,  EOT,  ENQ,  ACK,  BEL,
    BS,   HT,   LF,   VT,   FF,   CR,   SO,   SI,
    DLE,  DC1,  DC2,  DC3,  DC4,  NAK,  SYN,  ETB,
    CAN,  EM,   SUB,  ESC,  FSP,  GSP,  RSP,  USP,
    ' ',  '!',  '"',  '#',  '$',  '%',  '&',  ''',
    '(',  ')',  '*',  '+',  ',',  '-',  '.',  '/',
    '0',  '1',  '2',  '3',  '4',  '5',  '6',  '7',
    '8',  '9',  ':',  ';',  '<',  '=',  '>',  '?',
    '@',  'A',  'B',  'C',  'D',  'E',  'F',  'G',
    'H',  'I',  'J',  'K',  'L',  'M',  'N',  'O',
    'P',  'Q',  'R',  'S',  'T',  'U',  'V',  'W',
    'X',  'Y',  'Z',  '[',  '\',  ']',  '^',  '_',
    '`',  'a',  'b',  'c',  'd',  'e',  'f',  'g',
    'h',  'i',  'j',  'k',  'l',  'm',  'n',  'o',
    'p',  'q',  'r',  's',  't',  'u',  'v',  'w',
    'x',  'y',  'z',  '{',  '|',  '}',  '~',  DEL,
    C128, C129, C130, C131, C132, C133, C134, C135,
    C136, C137, C138, C139, C140, C141, C142, C143,
    C144, C145, C146, C147, C148, C149, C150, C151,
    C152, C153, C154, C155, C156, C157, C158, C159,
    ' ',  '¡',  '¢',  '£',  '¤',  '¥',  '¦',  '§',
    '¨',  '©',  'ª',  '«',  '¬',  '-',  '®',  '¯',
    '°',  '±',  '²',  '³',  '´',  'µ',  '¶',  '·',
    '¸',  '¹',  'º',  '»',  '¼',  '½',  '¾',  '¿',
    'À',  'Á',  'Â',  'Ã',  'Ä',  'Å',  'Æ',  'Ç',
    'È',  'É',  'Ê',  'Ë',  'Ì',  'Í',  'Î',  'Ï',
    'Ð',  'Ñ',  'Ò',  'Ó',  'Ô',  'Õ',  'Ö',  '×',
    'Ø',  'Ù',  'Ú',  'Û',  'Ü',  'Ý',  'Þ',  'ß',
    'à',  'á',  'â',  'ã',  'ä',  'å',  'æ',  'ç',
    'è',  'é',  'ê',  'ë',  'ì',  'í',  'î',  'ï',
    'ð',  'ñ',  'ò',  'ó',  'ô',  'õ',  'ö',  '÷',
    'ø',  'ù',  'ú',  'û',  'ü',  'ý',  'þ',  'ÿ'
  );
  -- The predefined operations for this type are as follows:
  -- function "="(anonymous, anonymous: CHARACTER) return BOOLEAN;
  -- function "/="(anonymous, anonymous: CHARACTER) return BOOLEAN;
  -- function "<"(anonymous, anonymous: CHARACTER) return BOOLEAN;
  -- function "<="(anonymous, anonymous: CHARACTER) return BOOLEAN;
  -- function ">"(anonymous, anonymous: CHARACTER) return BOOLEAN;
  -- function ">="(anonymous, anonymous: CHARACTER) return BOOLEAN;
  -- function MINIMUM (L, R: CHARACTER) return CHARACTER;
  -- function MAXIMUM (L, R: CHARACTER) return CHARACTER;
  -- Implicit defined range record for CHARACTER'RANGE_RECORD:
  -- type CHARACTER_range_record is record
  --   Left      : CHARACTER;
  --   Right     : CHARACTER;
  --   Direction : DIRECTION;
  -- end record;

  type SEVERITY_LEVEL is (NOTE, WARNING, ERROR, FAILURE);
  -- The predefined operations for this type are as follows:
  -- function "="(anonymous, anonymous: SEVERITY_LEVEL) return BOOLEAN;
  -- function "/="(anonymous, anonymous: SEVERITY_LEVEL) return BOOLEAN;
  -- function "<"(anonymous, anonymous: SEVERITY_LEVEL) return BOOLEAN;
  -- function "<="(anonymous, anonymous: SEVERITY_LEVEL) return BOOLEAN;
  -- function ">"(anonymous, anonymous: SEVERITY_LEVEL) return BOOLEAN;
  -- function ">="(anonymous, anonymous: SEVERITY_LEVEL) return BOOLEAN;
  -- function MINIMUM (L, R: SEVERITY_LEVEL) return SEVERITY_LEVEL;
  -- function MAXIMUM (L, R: SEVERITY_LEVEL) return SEVERITY_LEVEL;
  -- Implicit defined range record for SEVERITY_LEVEL'RANGE_RECORD:
  -- type SEVERITY_LEVEL_range_record is record
  --   Left      : SEVERITY_LEVEL;
  --   Right     : SEVERITY_LEVEL;
  --   Direction : DIRECTION;
  -- end record;

  -- type universal_integer is range implementation_defined;
  -- The predefined operations for this type are as follows:
  -- function "="(anonymous, anonymous: universal_integer) return BOOLEAN;
  -- function "/="(anonymous, anonymous: universal_integer) return BOOLEAN;
  -- function "<"(anonymous, anonymous: universal_integer) return BOOLEAN;
  -- function "<="(anonymous, anonymous: universal_integer) return BOOLEAN;
  -- function ">"(anonymous, anonymous: universal_integer) return BOOLEAN;
  -- function ">="(anonymous, anonymous: universal_integer) return BOOLEAN;
  -- function "+"(anonymous: universal_integer) return universal_integer;
  -- function "-"(anonymous: universal_integer) return universal_integer;
  -- function "abs"(anonymous: universal_integer) return universal_integer;
  -- function "+"(anonymous, anonymous: universal_integer) return universal_integer;
  -- function "-"(anonymous, anonymous: universal_integer) return universal_integer;
  -- function "*"(anonymous, anonymous: universal_integer) return universal_integer;
  -- function "/"(anonymous, anonymous: universal_integer) return universal_integer;
  -- function "mod"(anonymous, anonymous: universal_integer) return universal_integer;
  -- function "rem"(anonymous, anonymous: universal_integer) return universal_integer;
  -- function MINIMUM (L, R: universal_integer) return universal_integer;
  -- function MAXIMUM (L, R: universal_integer) return universal_integer;
  -- Implicit defined range record for universal_integer'RANGE_RECORD:
  -- type universal_integer_range_record is record
  --   Left      : universal_integer;
  --   Right     : universal_integer;
  --   Direction : DIRECTION;
  -- end record;
  
  -- type universal_real is range implementation_defined;
  -- The predefined operations for this type are as follows:
  -- function "="(anonymous, anonymous: universal_real) return BOOLEAN;
  -- function "/="(anonymous, anonymous: universal_real) return BOOLEAN;
  -- function "<"(anonymous, anonymous: universal_real) return BOOLEAN;
  -- function "<="(anonymous, anonymous: universal_real) return BOOLEAN;
  -- function ">"(anonymous, anonymous: universal_real) return BOOLEAN;
  -- function ">="(anonymous, anonymous: universal_real) return BOOLEAN;
  -- function "+"(anonymous: universal_real) return universal_real;
  -- function "-"(anonymous: universal_real) return universal_real;
  -- function "abs"(anonymous: universal_real) return universal_real;
  -- function "+"(anonymous, anonymous: universal_real) return universal_real;
  -- function "-"(anonymous, anonymous: universal_real) return universal_real;
  -- function "*"(anonymous, anonymous: universal_real) return universal_real;
  -- function "/"(anonymous, anonymous: universal_real) return universal_real;
  -- function "*"(anonymous: universal_real; anonymous: universal_integer) return universal_real;
  -- function "*"(anonymous: universal_integer; anonymous: universal_real) return universal_real;
  -- function "/"(anonymous: universal_real; anonymous: universal_integer) return universal_real;
  -- function MINIMUM (L, R: universal_real) return universal_real;
  -- function MAXIMUM (L, R: universal_real) return universal_real;
  -- Implicit defined range record for universal_real'RANGE_RECORD:
  -- type universal_real_range_record is record
  --   Left      : universal_real;
  --   Right     : universal_real;
  --   Direction : DIRECTION;
  -- end record;
  
  -- Predefined numeric types:
  type INTEGER is range implementation_defined;
  -- The predefined operations for this type are as follows:
  -- function "**"(anonymous: universal_integer; anonymous: INTEGER) return universal_integer;
  -- function "**"(anonymous: universal_real; anonymous: INTEGER) return universal_real;
  -- function "="(anonymous, anonymous: INTEGER) return BOOLEAN;
  -- function "/="(anonymous, anonymous: INTEGER) return BOOLEAN;
  -- function "<"(anonymous, anonymous: INTEGER) return BOOLEAN;
  -- function "<="(anonymous, anonymous: INTEGER) return BOOLEAN;
  -- function ">"(anonymous, anonymous: INTEGER) return BOOLEAN;
  -- function ">="(anonymous, anonymous: INTEGER) return BOOLEAN;
  -- function "+"(anonymous: INTEGER) return INTEGER;
  -- function "-"(anonymous: INTEGER) return INTEGER;
  -- function "abs"(anonymous: INTEGER) return INTEGER;
  -- function "+"(anonymous, anonymous: INTEGER) return INTEGER;
  -- function "-"(anonymous, anonymous: INTEGER) return INTEGER;
  -- function "*"(anonymous, anonymous: INTEGER) return INTEGER;
  -- function "/"(anonymous, anonymous: INTEGER) return INTEGER;
  -- function "mod"(anonymous, anonymous: INTEGER) return INTEGER;
  -- function "rem"(anonymous, anonymous: INTEGER) return INTEGER;
  -- function "**"(anonymous: INTEGER; anonymous: INTEGER) return INTEGER;
  -- function MINIMUM (L, R: INTEGER) return INTEGER;
  -- function MAXIMUM (L, R: INTEGER) return INTEGER;
  -- Implicit defined range record for INTEGER'RANGE_RECORD:
  -- type INTEGER_range_record is record
  --   Left      : INTEGER;
  --   Right     : INTEGER;
  --   Direction : DIRECTION;
  -- end record;
  
  type REAL is range implementation_defined;
  -- The predefined operations for this type are as follows:
  -- function "="(anonymous, anonymous: REAL) return BOOLEAN;
  -- function "/="(anonymous, anonymous: REAL) return BOOLEAN;
  -- function "<"(anonymous, anonymous: REAL) return BOOLEAN;
  -- function "<="(anonymous, anonymous: REAL) return BOOLEAN;
  -- function ">"(anonymous, anonymous: REAL) return BOOLEAN;
  -- function ">="(anonymous, anonymous: REAL) return BOOLEAN;
  -- function "+"(anonymous: REAL) return REAL;
  -- function "-"(anonymous: REAL) return REAL;
  -- function "abs"(anonymous: REAL) return REAL;
  -- function "+"(anonymous, anonymous: REAL) return REAL;
  -- function "-"(anonymous, anonymous: REAL) return REAL;
  -- function "*"(anonymous, anonymous: REAL) return REAL;
  -- function "/"(anonymous, anonymous: REAL) return REAL;
  -- function "**"(anonymous: REAL; anonymous: INTEGER) return REAL;
  -- function MINIMUM (L, R: REAL) return REAL;
  -- function MAXIMUM (L, R: REAL) return REAL;
  -- Implicit defined range record for REAL'RANGE_RECORD:
  -- type REAL_range_record is record
  --   Left      : REAL;
  --   Right     : REAL;
  --   Direction : DIRECTION;
  -- end record;
  
  -- Predefined type TIME:
  type TIME is range implementation_defined
    units
      fs;             -- femtosecond
      ps  = 1000 fs;  -- picosecond
      ns  = 1000 ps;  -- nanosecond
      us  = 1000 ns;  -- microsecond
      ms  = 1000 us;  -- millisecond
      sec = 1000 ms;  -- second
      min =   60 sec; -- minute
      hr  =   60 min; -- hour
    end units;
  -- The predefined operations for this type are as follows:
  -- function "="(anonymous, anonymous: TIME) return BOOLEAN;
  -- function "/="(anonymous, anonymous: TIME) return BOOLEAN;
  -- function "<"(anonymous, anonymous: TIME) return BOOLEAN;
  -- function "<="(anonymous, anonymous: TIME) return BOOLEAN;
  -- function ">"(anonymous, anonymous: TIME) return BOOLEAN;
  -- function ">="(anonymous, anonymous: TIME) return BOOLEAN;
  -- function "+"(anonymous: TIME) return TIME;
  -- function "- (anonymous: TIME) return TIME;
  -- function "abs"(anonymous: TIME) return TIME;
  -- function "+"(anonymous, anonymous: TIME) return TIME;
  -- function "-"(anonymous, anonymous: TIME) return TIME;
  -- function "*"(anonymous: TIME; anonymous: INTEGER) return TIME;
  -- function "*"(anonymous: TIME; anonymous: REAL) return TIME;
  -- function "*"(anonymous: INTEGER; anonymous: TIME) return TIME;
  -- function "*"(anonymous: REAL; anonymous: TIME) return TIME;
  -- function "/"(anonymous: TIME; anonymous: INTEGER) return TIME;
  -- function "/"(anonymous: TIME; anonymous: REAL) return TIME;
  -- function "/"(anonymous, anonymous: TIME) return universal_integer;
  -- function "mod"(anonymous, anonymous: TIME) return TIME;
  -- function "rem"(anonymous, anonymous: TIME) return TIME;
  -- function MINIMUM (L, R: TIME) return TIME;
  -- function MAXIMUM (L, R: TIME) return TIME;
  -- Implicit defined range record for TIME'RANGE_RECORD:
  -- type TIME_range_record is record
  --   Left      : TIME;
  --   Right     : TIME;
  --   Direction : DIRECTION;
  -- end record;

[...]

  -- The predefined types for opening files:
  type FILE_OPEN_KIND is (
    READ_MODE,  -- Resulting access mode is read-only.
    WRITE_MODE, -- Resulting access mode is write-only.
    APPEND_MODE -- Resulting access mode is write-only;
  );            -- information is appended to the end of the existing file.
  -- The predefined operations for this type are as follows:
  -- function "="(anonymous, anonymous: FILE_OPEN_KIND) return BOOLEAN;
  -- function "/="(anonymous, anonymous: FILE_OPEN_KIND) return BOOLEAN;
  -- function "<"(anonymous, anonymous: FILE_OPEN_KIND) return BOOLEAN;
  -- function "<="(anonymous, anonymous: FILE_OPEN_KIND) return BOOLEAN;
  -- function ">"(anonymous, anonymous: FILE_OPEN_KIND) return BOOLEAN;
  -- function ">="(anonymous, anonymous: FILE_OPEN_KIND) return BOOLEAN;
  -- function MINIMUM (L, R: FILE_OPEN_KIND) return FILE_OPEN_KIND;
  -- function MAXIMUM (L, R: FILE_OPEN_KIND) return FILE_OPEN_KIND;
  -- Implicit defined range record for FILE_OPEN_KIND'RANGE_RECORD:
  -- type FILE_OPEN_KIND_range_record is record
  --   Left      : FILE_OPEN_KIND;
  --   Right     : FILE_OPEN_KIND;
  --   Direction : DIRECTION;
  -- end record;
  
  type FILE_OPEN_STATUS is (
    OPEN_OK,      -- File open was successful.
    STATUS_ERROR, -- File object was already open.
    NAME_ERROR,   -- External file not found or inaccessible.
    MODE_ERROR    -- Could not open file with requested access mode.
  );
  -- The predefined operations for this type are as follows:
  -- function "="(anonymous, anonymous: FILE_OPEN_STATUS) return BOOLEAN;
  -- function "/="(anonymous, anonymous: FILE_OPEN_STATUS) return BOOLEAN;
  -- function "<"(anonymous, anonymous: FILE_OPEN_STATUS) return BOOLEAN;
  -- function "<="(anonymous, anonymous: FILE_OPEN_STATUS) return BOOLEAN;
  -- function ">"(anonymous, anonymous: FILE_OPEN_STATUS) return BOOLEAN;
  -- function ">="(anonymous, anonymous: FILE_OPEN_STATUS) return BOOLEAN;
  -- function MINIMUM (L, R: FILE_OPEN_STATUS) return FILE_OPEN_STATUS;
  -- function MAXIMUM (L, R: FILE_OPEN_STATUS) return FILE_OPEN_STATUS;
  -- Implicit defined range record for FILE_OPEN_STATUS'RANGE_RECORD:
  -- type FILE_OPEN_STATUS_range_record is record
  --   Left      : FILE_OPEN_STATUS;
  --   Right     : FILE_OPEN_STATUS;
  --   Direction : DIRECTION;
  -- end record;
  
[...]
end package STANDARD;

Annex C

range ::=
    range_attribute_name
  | simple_range simple_expression direction simple_expression
  | range_expression

simple_range ::= simple_expression direction simple_expression

array_type_definition ::=
    unbounded_array_definition | constrained_array_definition
  | constrained_array_definition

constrained_array_definition ::=
  array index_constraint of element_subtype_indication
    of element_subtype_indication

discrete_range ::= discrete_subtype_indication | range
    discrete_subtype_indication
  | range

Topic revision: r29 - 2017-04-06 - 16:08:59 - PatrickLehmann
 
Copyright © 2008-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback