Lady Ada

Ada '83 Language Reference Manual

Copyright 1980, 1982, 1983 owned by the United States Government. Direct reproduction and usage requests to the Ada Information Clearinghouse.


C. Predefined Language Environment

Style Guide references: 3.4.1 Declaring Types, 5.7.1 The Use Clause, 6.1.5 Delay Statements, 7.1.1 Global Assumptions, 7.1.6 Implementation-Added Features, 7.2.1 Predefined Numeric Types, 7.5.1 Predefined Exceptions, 7.5.2 Constraint_Error and Numeric_Error, 7.6.3 Machine Code Inserts


This annex outlines the specification of the package STANDARD containing all predefined identifiers in the language. The corresponding package body is implementation-defined and is not shown.

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 universal_real) and for undefined information (such as implementation_defined and any_fixed_point_type).

package STANDARD is 
   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 universal type universal_integer is predefined.  

   type INTEGER is implementation_defined; 

   -- The predefined operators for this type 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 : INTEGER) return INTEGER; 

   -- An  implementation  may  provide additional predefined integer types.
   -- It is recommended that  the  names  of such additional types end with
   -- INTEGER as in SHORT_INTEGER  or  LONG_INTEGER.  The  specification of
   -- each operator for the type universal_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, except  for the  right  operand of the
   -- exponentiating operator.

   -- The universal type universal_real is predefined.

   type FLOAT is 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; 

   -- An implementation may provide  additional  predefined  floating point
   -- point  types.   It is recommended that the names of  such  additional
   -- types   end   with   FLOAT  as  in  SHORT_FLOAT  or  LONG_FLOAT.  The
   -- specification of each operator for the type  universal_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  universal
      types: 

   -- function "*" (LEFT : universal_integer; RIGHT : universal_real)
      return universal_real;

   -- function "*" (LEFT : universal_real;    RIGHT : universal_integer)
      return universal_real;

   -- function "/" (LEFT : universal_real;    RIGHT : universal_integer)
      return universal_real;

   -- The  type universal_fixed is predefined.  The only operators declared
      for this type are

   -- function "*" (LEFT : any_fixed_point_type; RIGHT : any_fixed_point_type)
      return universal_fixed;

   -- function "/" (LEFT : any_fixed_point_type; RIGHT : any_fixed_point_type)
      return universal_fixed;

  --  The  following  characters  form  the  standard  ASCII character set.
      set.   Character  literals -- corresponding to control characters are
      not  identifiers;   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);  

  for CHARACTER use  --  128 ASCII character set without holes
       (0, 1, 2, 3, 4, 5, ..., 125, 126, 127); 

  -- The predefined operators for the type CHARACTER are the  same  as  for
     any enumeration type.                                                       

  package ASCII is

      --  Control characters: 

  NUL   : constant CHARACTER := nul;     SOH   : constant CHARACTER := soh:
  STX   : constant CHARACTER := stx;     ETX   : constant CHARACTER := etx;
  EOT   : constant CHARACTER := eot;     ENQ   : constant CHARACTER := enq:
  ACK   : constant CHARACTER := ack;     BEL   : constant CHARACTER := bel;
  BS    : constant CHARACTER := bs;      HT    : constant CHARACTER := ht;
  LF    : constant CHARACTER := lf;      VT    : constant CHARACTER := vt;
  FF    : constant CHARACTER := ff;      CR    : constant CHARACTER := cr;
  SO    : constant CHARACTER := so;      SI    : constant CHARACTER := si;
  DLE   : constant CHARACTER := dle;     DC1   : constant CHARACTER := dc1;
  DC2   : constant CHARACTER := dc2;     DC3   : constant CHARACTER := dc3;
  DC4   : constant CHARACTER := dc4;     NAK   : constant CHARACTER := nak;
  SYN   : constant CHARACTER := syn;     ETB   : constant CHARACTER := etb;
  CAN   : constant CHARACTER := can;     EM    : constant CHARACTER := em:
  SUB   : constant CHARACTER := sub;     ESC   : constant CHARACTER := esc;
  FS    : constant CHARACTER := fs;      GS    : constant CHARACTER := gs;
  RS    : constant CHARACTER := rs;      US    : constant CHARACTER := us;
  DEL   : constant CHARACTER := del;

      -- Other characters: 

  EXCLAM   : constant CHARACTER := '!';  QUOTATION : constant CHARACTER := '"';
  SHARP    : constant CHARACTER := '#';  DOLLAR    : constant CHARACTER := '$';
  PERCENT  : constant CHARACTER := '%';  AMPERSAND : constant CHARACTER := '&';
  COLON    : constant CHARACTER := ':';  SEMICOLON : constant CHARACTER := ';';
  QUERY    : constant CHARACTER := '?';  AT_SIGN   : constant CHARACTER := '@';
  L_BRACKET: constant CHARACTER := '[';  BACK_SLASH: constant CHARACTER := '\';
  R_BRACKET: constant CHARACTER := ']';  CIRCUMFLEX: constant CHARACTER := '~';
  UNDERLINE: constant CHARACTER := '_';  GRAVE     : constant CHARACTER := '`';
  L_BRACE  : constant CHARACTER := '{';  BAR       : constant CHARACTER := '|';
  R_BRACE  : constant CHARACTER := '}';  TILDE     : constant CHARACTER := '~';

      -- Lower case letters: 

      LC_A : constant CHARACTER := 'a';
      ...
      LC_Z : constant CHARACTER := 'z'; 

   end ASCII;  

       -- Predefined subtypes: 

       subtype NATURAL  is INTEGER range 0 .. INTEGER'LAST;
       subtype POSITIVE is INTEGER range 1 .. INTEGER'LAST;                           

       -- Predefined string type: 

       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 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;
   NUMERIC_ERROR    : exception;
   PROGRAM_ERROR    : exception;
   STORAGE_ERROR    : exception;
   TASKING_ERROR    : exception; 

end STANDARD;

Certain aspects of the predefined entities cannot be completely described in the language itself. For example, although the enumeration type BOOLEAN can be written showing the two enumeration literals FALSE and TRUE, the short-circuit control forms cannot be expressed in the language.

Note:

The language definition predefines the following library units:

[INDEX][CONTENTS]


[Ada Information Clearinghouse]

Address any questions or comments to adainfo@sw-eng.falls-church.va.us.