Skip to content

Standard#

This subclause outlines the specification of the package Standard containing all predefined identifiers in the language. The corresponding package body is not specified by the language.

The operators that are predefined for the types declared in the package Standard are given in comments since they are implicitly declared. Italics are used for pseudo-names of anonymous types (such as root_real) and for undefined information (such as ).

package Standard
   with Pure is

   type Boolean is (False, True);

   function "=" (Left, Right: Boolean'Base) return Boolean;
   function "/="(Left, Right: Boolean'Base) return Boolean;
   function "<" (Left, Right: Boolean'Base) return Boolean;
   function "<="(Left, Right: Boolean'Base) return Boolean;
   function ">" (Left, Right: Boolean'Base) return Boolean;
   function ">="(Left, Right: Boolean'Base) return Boolean;

   function "and"(Left, Right: Boolean'Base) return Boolean'Base;
   function "or" (Left, Right: Boolean'Base) return Boolean'Base;
   function "xor"(Left, Right: Boolean'Base) return Boolean'Base;
   function "not"(Right: Boolean'Base)       return Boolean'Base;

   -- The integer type root_integer and the corresponding universal type universal_integer are predefined.
   type Integer is range <implementation-defined>;

   subtype Natural  is Integer range 0 .. Integer'Last;
   subtype Positive is Integer range 1 .. Integer'Last;

   function "=" (Left, Right: Integer'Base) return Boolean;
   function "/="(Left, Right: Integer'Base) return Boolean;
   function "<" (Left, Right: Integer'Base) return Boolean;
   function "<="(Left, Right: Integer'Base) return Boolean;
   function ">" (Left, Right: Integer'Base) return Boolean;
   function ">="(Left, Right: Integer'Base) return Boolean;

   function "+"  (Right: Integer'Base) return Integer'Base;
   function "-"  (Right: Integer'Base) return Integer'Base;
   function "abs"(Right: Integer'Base) return Integer'Base;

   function "+"  (Left, Right: Integer'Base) return Integer'Base;
   function "-"  (Left, Right: Integer'Base) return Integer'Base;
   function "*"  (Left, Right: Integer'Base) return Integer'Base;
   function "/"  (Left, Right: Integer'Base) return Integer'Base;
   function "rem"(Left, Right: Integer'Base) return Integer'Base;
   function "mod"(Left, Right: Integer'Base) return Integer'Base;

   function "**"(Left: Integer'Base; Right: Natural) return Integer'Base;

   -- The specification of each operator for the type root_integer, or for any additional predefined
   -- integer type, is obtained by replacing Integer by the name of the type in the specification of
   -- the corresponding operator of the type Integer. The right operand of the exponentiation operator
   -- remains as subtype Natural.

   -- The floating point type root_real and the corresponding universal type universal_real are predefined.
   type Float is digits <implementation-defined>;

   function "=" (Left, Right: Float) return Boolean;
   function "/="(Left, Right: Float) return Boolean;
   function "<" (Left, Right: Float) return Boolean;
   function "<="(Left, Right: Float) return Boolean;
   function ">" (Left, Right: Float) return Boolean;
   function ">="(Left, Right: Float) return Boolean;

   function "+"  (Right: Float) return Float;
   function "-"  (Right: Float) return Float;
   function "abs"(Right: Float) return Float;

   function "+"(Left, Right: Float) return Float;
   function "-"(Left, Right: Float) return Float;
   function "*"(Left, Right: Float) return Float;
   function "/"(Left, Right: Float) return Float;

   function "**"(Left: Float; Right: Integer'Base) return Float;

   -- The specification of each operator for the type root_real, or for any additional predefined
   -- floating point type, is obtained by replacing Float by the name of the type in the
   -- specification of the corresponding operator of the type Float.

   -- In addition, the following operators are predefined for the root numeric types:
   function "*"(Left: root_integer; Right: root_real)    return root_real;
   function "*"(Left: root_real;    Right: root_integer) return root_real;
   function "/"(Left: root_real;    Right: root_integer) return root_real;

   -- The type universal_fixed is predefined. The only multiplying operators defined between
   -- fixed point types are:
   function "*"(Left: universal_fixed; Right: universal_fixed) return universal_fixed;
   function "/"(Left: universal_fixed; Right: universal_fixed) return universal_fixed;

   -- The type universal_access is predefined. The following equality operators are predefined:
   function "=" (Left, Right: universal_access) return Boolean;
   function "/="(Left, Right: universal_access) return Boolean;

   -- The declaration of type Character is based on the standard ISO 8859-1 character set.
   -- !! Check the manual for the definition !!
   type Character is -- ...

   -- The predefined operators for the type Character are the same as for any enumeration type.
   -- The declaration of type Wide_Character is based on the standard ISO/IEC 10646:2020 2011 BMP
   -- character set. The first 256 positions have the same contents as type Character.
   type Wide_Character is (nul, soh ... 0x0000_FFFE, 0x0000_FFFF);

   -- The declaration of type Wide_Wide_Character is based on the full ISO/IEC 10646:2020 2011
   -- character set. The first 65536 positions have the same contents as type Wide_Character.
   type Wide_Wide_Character is (nul, soh ... 0x7FFF_FFFE, 0x7FFF_FFFF);
   for Wide_Wide_Character'Size use 32;

   package ASCII is ... end ASCII;  -- Obsolescent

   -- Predefined string types:
   type String is array(Positive range <>) of Character
      with Pack;

   function "=" (Left, Right: String) return Boolean;
   function "/="(Left, Right: String) return Boolean;
   function "<" (Left, Right: String) return Boolean;
   function "<="(Left, Right: String) return Boolean;
   function ">" (Left, Right: String) return Boolean;
   function ">="(Left, Right: String) return Boolean;

   function "&"(Left: String;    Right: String)    return String;
   function "&"(Left: Character; Right: String)    return String;
   function "&"(Left: String;    Right: Character) return String;
   function "&"(Left: Character; Right: Character) return String;

   type Wide_String is array(Positive range <>) of Wide_Character
      with Pack;
   -- The predefined operators for this type correspond to those for String.

   type Wide_Wide_String is array (Positive range <>) of Wide_Wide_Character
      with Pack;
   -- The predefined operators for this type correspond to those for String.

   type Duration is delta <implementation-defined> range <implementation-defined>;
   -- The predefined operators for the type Duration are the same as for any fixed point type.

   Constraint_Error: exception;
   Program_Error   : exception;
   Storage_Error   : exception;
   Tasking_Error   : exception;
end Standard;