home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / adav313.zip / gnat-3_13p-os2-bin-20010916.zip / emx / gnatlib / s-stalib.ads < prev    next >
Text File  |  2000-07-19  |  10KB  |  206 lines

  1. ------------------------------------------------------------------------------
  2. --                                                                          --
  3. --                         GNAT COMPILER COMPONENTS                         --
  4. --                                                                          --
  5. --              S Y S T E M . S T A N D A R D _ L I B R A R Y               --
  6. --                                                                          --
  7. --                                 S p e c                                  --
  8. --                                                                          --
  9. --                            $Revision: 1.37 $
  10. --                                                                          --
  11. --          Copyright (C) 1992-2000 Free Software Foundation, Inc.          --
  12. --                                                                          --
  13. -- GNAT is free software;  you can  redistribute it  and/or modify it under --
  14. -- terms of the  GNU General Public License as published  by the Free Soft- --
  15. -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
  16. -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
  17. -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
  18. -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
  19. -- for  more details.  You should have  received  a copy of the GNU General --
  20. -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
  21. -- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
  22. -- MA 02111-1307, USA.                                                      --
  23. --                                                                          --
  24. -- As a special exception,  if other files  instantiate  generics from this --
  25. -- unit, or you link  this unit with other files  to produce an executable, --
  26. -- this  unit  does not  by itself cause  the resulting  executable  to  be --
  27. -- covered  by the  GNU  General  Public  License.  This exception does not --
  28. -- however invalidate  any other reasons why  the executable file  might be --
  29. -- covered by the  GNU Public License.                                      --
  30. --                                                                          --
  31. -- GNAT was originally developed  by the GNAT team at  New York University. --
  32. -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
  33. --                                                                          --
  34. ------------------------------------------------------------------------------
  35.  
  36. --  This package is included in all programs. It contains declarations that
  37. --  are required to be part of every Ada program. A special mechanism is
  38. --  required to ensure that these are loaded, since it may be the case in
  39. --  some programs that the only references to these required packages are
  40. --  from C code or from code generated directly by Gigi, an in both cases
  41. --  the binder is not aware of such references.
  42.  
  43. --  System.Standard_Library also includes data that must be present in every
  44. --  program, in particular the definitions of all the standard and also some
  45. --  subprograms that must be present in every program.
  46.  
  47. --  The binder unconditionally includes s-stalib.ali, which ensures that this
  48. --  package and the packages it references are included in all Ada programs,
  49. --  together with the included data.
  50.  
  51. pragma Polling (Off);
  52. --  We must turn polling off for this unit, because otherwise we get
  53. --  elaboration circularities with Ada.Exceptions if polling is on.
  54.  
  55. with System;
  56. with Unchecked_Conversion;
  57.  
  58. package System.Standard_Library is
  59.  
  60.    pragma Suppress (All_Checks);
  61.    --  Suppress explicitely all the checks to work around the Solaris linker
  62.    --  bug when using gnatmake -f -a (but without -gnatp). This is not needed
  63.    --  with Solaris 2.6, so eventually can be removed ???
  64.  
  65.    type Big_String_Ptr is access all String (Positive);
  66.    --  A non-fat pointer type for null terminated strings
  67.  
  68.    function To_Ptr is
  69.      new Unchecked_Conversion (System.Address, Big_String_Ptr);
  70.  
  71.    -------------------------------------
  72.    -- Exception Declarations and Data --
  73.    -------------------------------------
  74.  
  75.    type Exception_Data;
  76.    type Exception_Data_Ptr is access all Exception_Data;
  77.    --  An equivalent of Exception_Id that is public
  78.  
  79.    --  The following record defines the underlying representation of exceptions
  80.  
  81.    --  WARNING! Any changes to this may need to be reflectd in the following
  82.    --  locations in the compiler and runtime code:
  83.  
  84.    --    1. The Internal_Exception routine in s-exctab.adb
  85.    --    2. The processing in gigi that tests Not_Handled_By_Others
  86.    --    3. Expand_N_Exception_Declaration in Exp_Ch11
  87.    --    4. The construction of the exception type in Cstand
  88.  
  89.    type Exception_Data is record
  90.       Not_Handled_By_Others : Boolean;
  91.       --  Normally set False, indicating that the exception is handled in the
  92.       --  usual way by others (i.e. an others handler handles the exception).
  93.       --  Set True to indicate that this exception is not caught by others
  94.       --  handlers, but must be explicitly named in a handler. This latter
  95.       --  setting is currently used by the Abort_Signal.
  96.  
  97.       Lang : String (1 .. 3);
  98.       --  A 3-character string indicating the language raising the exception.
  99.       --  This field is not currently used, it is set to "Ada" for exceptions
  100.       --  defined by an Ada program.
  101.  
  102.       Name_Length : Natural;
  103.       --  Length of fully expanded name of exception
  104.  
  105.       Full_Name : Big_String_Ptr;
  106.       --  Fully expanded name of exception, null terminated
  107.  
  108.       HTable_Ptr : Exception_Data_Ptr;
  109.       --  Hash table pointer used to link entries together in the hash table
  110.       --  built (by Register_Exception in s-exctab.adb) for converting between
  111.       --  identities and names.
  112.  
  113.       Import_Code : Integer;
  114.       --  Value for imported exceptions. Needed only for the handling of
  115.       --  Import/Export_Exception for the VMS case, but present in all
  116.       --  implementations (we might well extend this mechanism for other
  117.       --  systems in the future).
  118.  
  119.    end record;
  120.  
  121.    --  Definitions for standard predefined exceptions defined in Standard,
  122.  
  123.    --  Why are the Nul's necessary here, seems like they should not be
  124.    --  required, since Gigi is supposed to add a Nul to each name ???
  125.  
  126.    Constraint_Error_Name : constant String := "CONSTRAINT_ERROR" & ASCII.NUL;
  127.    Program_Error_Name    : constant String := "PROGRAM_ERROR"    & ASCII.NUL;
  128.    Storage_Error_Name    : constant String := "STORAGE_ERROR"    & ASCII.NUL;
  129.    Tasking_Error_Name    : constant String := "TASKING_ERROR"    & ASCII.NUL;
  130.    Abort_Signal_Name     : constant String := "_ABORT_SIGNAL"    & ASCII.NUL;
  131.  
  132.    Numeric_Error_Name    : constant String := "NUMERIC_ERROR"    & ASCII.NUL;
  133.    --  This is used only in the Ada 83 case, but it is not worth having a
  134.    --  separate version of s-stalib.ads for use in Ada 83 mode.
  135.  
  136.    Constraint_Error_Def : aliased Exception_Data :=
  137.      (Not_Handled_By_Others => False,
  138.       Lang                  => "Ada",
  139.       Name_Length           => Constraint_Error_Name'Length,
  140.       Full_Name             => To_Ptr (Constraint_Error_Name'Address),
  141.       HTable_Ptr            => null,
  142.       Import_Code           => 0);
  143.  
  144.    Numeric_Error_Def : aliased Exception_Data :=
  145.      (Not_Handled_By_Others => False,
  146.       Lang                  => "Ada",
  147.       Name_Length           => Numeric_Error_Name'Length,
  148.       Full_Name             => To_Ptr (Numeric_Error_Name'Address),
  149.       HTable_Ptr            => null,
  150.       Import_Code           => 0);
  151.  
  152.    Program_Error_Def : aliased Exception_Data :=
  153.      (Not_Handled_By_Others => False,
  154.       Lang                  => "Ada",
  155.       Name_Length           => Program_Error_Name'Length,
  156.       Full_Name             => To_Ptr (Program_Error_Name'Address),
  157.       HTable_Ptr            => null,
  158.       Import_Code           => 0);
  159.  
  160.    Storage_Error_Def : aliased Exception_Data :=
  161.      (Not_Handled_By_Others => False,
  162.       Lang                  => "Ada",
  163.       Name_Length           => Storage_Error_Name'Length,
  164.       Full_Name             => To_Ptr (Storage_Error_Name'Address),
  165.       HTable_Ptr            => null,
  166.       Import_Code           => 0);
  167.  
  168.    Tasking_Error_Def : aliased Exception_Data :=
  169.      (Not_Handled_By_Others => False,
  170.       Lang                  => "Ada",
  171.       Name_Length           => Tasking_Error_Name'Length,
  172.       Full_Name             => To_Ptr (Tasking_Error_Name'Address),
  173.       HTable_Ptr            => null,
  174.       Import_Code           => 0);
  175.  
  176.    Abort_Signal_Def : aliased Exception_Data :=
  177.      (Not_Handled_By_Others => True,
  178.       Lang                  => "Ada",
  179.       Name_Length           => Abort_Signal_Name'Length,
  180.       Full_Name             => To_Ptr (Abort_Signal_Name'Address),
  181.       HTable_Ptr            => null,
  182.       Import_Code           => 0);
  183.  
  184.    pragma Export (C, Constraint_Error_Def, "constraint_error");
  185.    pragma Export (C, Numeric_Error_Def,    "numeric_error");
  186.    pragma Export (C, Program_Error_Def,    "program_error");
  187.    pragma Export (C, Storage_Error_Def,    "storage_error");
  188.    pragma Export (C, Tasking_Error_Def,    "tasking_error");
  189.    pragma Export (C, Abort_Signal_Def,     "_abort_signal");
  190.  
  191.    Local_Partition_ID : Natural := 0;
  192.    --  This variable contains the local Partition_ID that will be used when
  193.    --  building exception occurrences. In distributed mode, it will be
  194.    --  set by each partition to the correct value during the elaboration.
  195.  
  196.    -----------------
  197.    -- Subprograms --
  198.    -----------------
  199.  
  200.    procedure Abort_Undefer_Direct;
  201.    pragma Inline (Abort_Undefer_Direct);
  202.    --  A little procedure that just calls Abort_Undefer.all, for use in
  203.    --  clean up procedures, which only permit a simple subprogram name.
  204.  
  205. end System.Standard_Library;
  206.