Previous | Next | Table of Contents | Index | Program List | Copyright

Appendix C: The Package Standard--Ada's Predefined Environment

This appendix, adapted from the Ada 95 Reference Manual, Section A.1, 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 implementation-defined).

PACKAGE Standard is
  PRAGMA Pure( Standard);

  TYPE Boolean IS ( False, True);

  -- The predefined relational operators for this type are as follows:

  -- FUNCTION "="   ( Left, Right : Boolean) RETURN Boolean;
  -- FUNCTION "/="  ( Left, Right : Boolean) RETURN Boolean;
  -- FUNCTION "<"   ( Left, Right : Boolean) RETURN Boolean;
  -- FUNCTION "<="  ( Left, Right : Boolean) RETURN Boolean;
  -- FUNCTION ">"   ( Left, Right : Boolean) RETURN Boolean;
  -- FUNCTION ">="  ( Left, Right : Boolean) RETURN Boolean;

  -- The predefined logical operators and the predefined logical
  -- negation operator are as follows:

  -- FUNCTION "AND" ( Left, Right : Boolean) RETURN Boolean;
  -- FUNCTION "OR"  ( Left, Right : Boolean) RETURN Boolean;
  -- FUNCTION "XOR" ( Left, Right : Boolean) RETURN Boolean;

  -- FUNCTION "NOT" ( Right : Boolean) RETURN Boolean;

  -- The integer type root_integer is predefined.
  -- The corresponding universal type is universal_integer.

  TYPE Integer IS RANGE implementation-defined;

  SUBTYPE Natural  IS Integer RANGE  0.. Integer'Last;
  SUBTYPE Positive IS Integer RANGE  1.. Integer'Last;

  -- The predefined operators for type Integer are as follows:

  -- FUNCTION "="  ( Left, Right : Integer) RETURN Boolean;
  -- FUNCTION "/=" ( Left, Right : Integer) RETURN Boolean;
  -- FUNCTION "<"  ( Left, Right : Integer) RETURN Boolean;
  -- FUNCTION "<=" ( Left, Right : Integer) RETURN Boolean;
  -- FUNCTION ">"  ( Left, Right : Integer) RETURN Boolean;
  -- FUNCTION ">=" ( Left, Right : Integer) RETURN Boolean;

  -- FUNCTION "+"   ( Right : Integer) RETURN Integer;
  -- FUNCTION "-"   ( Right : Integer) RETURN Integer;
  -- FUNCTION "ABS" ( Right : Integer) RETURN Integer;

  -- FUNCTION "+"   ( Left, Right : Integer) RETURN Integer;
  -- FUNCTION "-"   ( Left, Right : Integer) RETURN Integer;
  -- FUNCTION "*"   ( Left, Right : Integer) RETURN Integer;
  -- FUNCTION "/"   ( Left, Right : Integer) RETURN Integer;
  -- FUNCTION "REM" ( Left, Right : Integer) RETURN Integer;
  -- FUNCTION "MOD" ( Left, Right : Integer) RETURN Integer;

  -- FUNCTION "**"  ( Left : Integer; Right : Natural) RETURN Integer;

  -- 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 is predefined.
  -- The corresponding universal type is universal_real.

  TYPE Float IS DIGITS implementation-defined;

  -- The predefined operators for this type are as follows:

  -- 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) 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 declaration of type Character is based on the standard ISO
  -- 8859-1 character set.

  -- There are no character literals corresponding to the positions 
  -- for control characters.
  -- They are indicated in italics in this definition.

  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,     fs,   gs,   rs,   us,

    ' ',  '!',  '"',  '#',     '$',  '%',  '&',  ''',
    '( ',  ')',  '*',  '+',     ',',  '-',  '.',  '/',

    '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,


    reserved_128,     reserved_129,  bph,  nbh,
    reserved_132,     nel,     ssa,  esa,

    hts,  htj,  vts,  pld,     plu,  ri,   ss2,  ss3,

    dcs,  pu1,  pu2,  sts,     cch,  mw,   spa,  epa,

    sos, reserved_153, sci, csi,
    st,   osc,  pm,   apc,

   ... );

  -- 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 10646 BMP character set.
  -- The first 256 positions have the same contents as type 
  -- Character.

  TYPE Wide_Character IS ( nul, soh ... FFFE, FFFF);


  PACKAGE ASCII IS ... END ASCII;  --Obsolescent; see J. 


  -- Predefined string types:

  TYPE String IS ARRAY( Positive RANGE <>) OF Character;
    PRAGMA Pack( String);

  -- The predefined operators for this type are as follows:

  --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;
    PRAGMA Pack( Wide_String);

  -- 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.

  -- The predefined exceptions:

       Constraint_Error: EXCEPTION;
       Program_Error   : EXCEPTION;
       Storage_Error   : EXCEPTION;
       Tasking_Error   : EXCEPTION;

END Standard;


Previous | Next | Table of Contents | Index | Program List | Copyright

Copyright © 1996 by Addison-Wesley Publishing Company, Inc.