OSDN Git Service

* doc/install.texi (Specific, mips-sgi-irix5): Document IRIX 5
[pf3gnuchains/gcc-fork.git] / gcc / ada / s-parint.adb
index 1174d75..53cc49c 100644 (file)
@@ -7,25 +7,23 @@
 --                                  B o d y                                 --
 --                   (Dummy body for non-distributed case)                  --
 --                                                                          --
---          Copyright (C) 1995-2004 Free Software Foundation, Inc.          --
+--          Copyright (C) 1995-2009, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNARL is free software; you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
--- ware  Foundation;  either version 2,  or (at your option) any later ver- --
--- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
--- for  more details.  You should have  received  a copy of the GNU General --
--- Public License  distributed with GNARL; see file COPYING.  If not, write --
--- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
--- MA 02111-1307, USA.                                                      --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
 --                                                                          --
--- As a special exception,  if other files  instantiate  generics from this --
--- unit, or you link  this unit with other files  to produce an executable, --
--- this  unit  does not  by itself cause  the resulting  executable  to  be --
--- covered  by the  GNU  General  Public  License.  This exception does not --
--- however invalidate  any other reasons why  the executable file  might be --
--- covered by the  GNU Public License.                                      --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
 --                                                                          --
 -- GNAT was originally developed  by the GNAT team at  New York University. --
 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
 
 package body System.Partition_Interface is
 
-   pragma Warnings (Off); -- supress warnings for unreferenced formals
+   pragma Warnings (Off); -- suppress warnings for unreferenced formals
 
    M : constant := 7;
 
    type String_Access is access String;
 
-   --  To have a minimal implementation of U'Partition_ID.
+   --  To have a minimal implementation of U'Partition_ID
 
    type Pkg_Node;
    type Pkg_List is access Pkg_Node;
    type Pkg_Node is record
-      Name : String_Access;
-      Next : Pkg_List;
+      Name          : String_Access;
+      Subp_Info     : System.Address;
+      Subp_Info_Len : Integer;
+      Next          : Pkg_List;
    end record;
 
    Pkg_Head : Pkg_List;
@@ -63,9 +63,9 @@ package body System.Partition_Interface is
    --  String prepended in top of shared passive packages
 
    procedure Check
-     (Name    : in Unit_Name;
-      Version : in String;
-      RCI     : in Boolean := True)
+     (Name    : Unit_Name;
+      Version : String;
+      RCI     : Boolean := True)
    is
    begin
       null;
@@ -76,8 +76,7 @@ package body System.Partition_Interface is
    -----------------------------
 
    function Get_Active_Partition_ID
-     (Name : Unit_Name)
-      return System.RPC.Partition_ID
+     (Name : Unit_Name) return System.RPC.Partition_ID
    is
       P : Pkg_List := Pkg_Head;
       N : String   := Lower (Name);
@@ -98,10 +97,7 @@ package body System.Partition_Interface is
    -- Get_Active_Version --
    ------------------------
 
-   function Get_Active_Version
-     (Name : Unit_Name)
-      return String
-   is
+   function Get_Active_Version (Name : Unit_Name) return String is
    begin
       return "";
    end Get_Active_Version;
@@ -120,8 +116,7 @@ package body System.Partition_Interface is
    ------------------------------
 
    function Get_Passive_Partition_ID
-     (Name : Unit_Name)
-      return System.RPC.Partition_ID
+     (Name : Unit_Name) return System.RPC.Partition_ID
    is
    begin
       return Get_Local_Partition_ID;
@@ -131,21 +126,50 @@ package body System.Partition_Interface is
    -- Get_Passive_Version --
    -------------------------
 
-   function Get_Passive_Version
-     (Name : Unit_Name)
-      return String
-   is
+   function Get_Passive_Version (Name : Unit_Name) return String is
    begin
       return "";
    end Get_Passive_Version;
 
+   ------------------
+   -- Get_RAS_Info --
+   ------------------
+
+   procedure Get_RAS_Info
+     (Name          :  Unit_Name;
+      Subp_Id       :  Subprogram_Id;
+      Proxy_Address : out Interfaces.Unsigned_64)
+   is
+      LName : constant String := Lower (Name);
+      N : Pkg_List;
+   begin
+      N := Pkg_Head;
+      while N /= null loop
+         if N.Name.all = LName then
+            declare
+               subtype Subprogram_Array is RCI_Subp_Info_Array
+                 (First_RCI_Subprogram_Id ..
+                  First_RCI_Subprogram_Id + N.Subp_Info_Len - 1);
+               Subprograms : Subprogram_Array;
+               for Subprograms'Address use N.Subp_Info;
+               pragma Import (Ada, Subprograms);
+            begin
+               Proxy_Address :=
+                 Interfaces.Unsigned_64 (Subprograms (Integer (Subp_Id)).Addr);
+               return;
+            end;
+         end if;
+         N := N.Next;
+      end loop;
+      Proxy_Address := 0;
+   end Get_RAS_Info;
+
    ------------------------------
    -- Get_RCI_Package_Receiver --
    ------------------------------
 
    function Get_RCI_Package_Receiver
-     (Name : Unit_Name)
-      return Interfaces.Unsigned_64
+     (Name : Unit_Name) return Interfaces.Unsigned_64
    is
    begin
       return 0;
@@ -186,18 +210,17 @@ package body System.Partition_Interface is
    -------------------------------------
 
    procedure Raise_Program_Error_Unknown_Tag
-     (E : in Ada.Exceptions.Exception_Occurrence)
+     (E : Ada.Exceptions.Exception_Occurrence)
    is
    begin
-      Ada.Exceptions.Raise_Exception
-        (Program_Error'Identity, Ada.Exceptions.Exception_Message (E));
+      raise Program_Error with Ada.Exceptions.Exception_Message (E);
    end Raise_Program_Error_Unknown_Tag;
 
-   --------------
-   -- RCI_Info --
-   --------------
+   -----------------
+   -- RCI_Locator --
+   -----------------
 
-   package body RCI_Info is
+   package body RCI_Locator is
 
       -----------------------------
       -- Get_Active_Partition_ID --
@@ -228,18 +251,19 @@ package body System.Partition_Interface is
          return 0;
       end Get_RCI_Package_Receiver;
 
-   end RCI_Info;
+   end RCI_Locator;
 
    ------------------------------
    -- Register_Passive_Package --
    ------------------------------
 
    procedure Register_Passive_Package
-     (Name    : in Unit_Name;
-      Version : in String := "")
+     (Name    : Unit_Name;
+      Version : String := "")
    is
    begin
-      Register_Receiving_Stub (Passive_Prefix & Name, null, Version);
+      Register_Receiving_Stub
+        (Passive_Prefix & Name, null, Version, System.Null_Address, 0);
    end Register_Passive_Package;
 
    -----------------------------
@@ -247,19 +271,23 @@ package body System.Partition_Interface is
    -----------------------------
 
    procedure Register_Receiving_Stub
-     (Name     : in Unit_Name;
-      Receiver : in RPC.RPC_Receiver;
-      Version  : in String := "")
+     (Name          : Unit_Name;
+      Receiver      : RPC_Receiver;
+      Version       : String := "";
+      Subp_Info     : System.Address;
+      Subp_Info_Len : Integer)
    is
+      N : constant Pkg_List :=
+            new Pkg_Node'(new String'(Lower (Name)),
+                          Subp_Info, Subp_Info_Len,
+                          Next => null);
    begin
       if Pkg_Tail = null then
-         Pkg_Head := new Pkg_Node'(new String'(Lower (Name)), null);
-         Pkg_Tail := Pkg_Head;
-
+         Pkg_Head := N;
       else
-         Pkg_Tail.Next := new Pkg_Node'(new String'(Lower (Name)), null);
-         Pkg_Tail := Pkg_Tail.Next;
+         Pkg_Tail.Next := N;
       end if;
+      Pkg_Tail := N;
    end Register_Receiving_Stub;
 
    ---------
@@ -267,7 +295,7 @@ package body System.Partition_Interface is
    ---------
 
    procedure Run
-     (Main : in Main_Subprogram_Type := null)
+     (Main : Main_Subprogram_Type := null)
    is
    begin
       if Main /= null then
@@ -275,4 +303,18 @@ package body System.Partition_Interface is
       end if;
    end Run;
 
+   --------------------
+   -- Same_Partition --
+   --------------------
+
+   function Same_Partition
+      (Left  : not null access RACW_Stub_Type;
+       Right : not null access RACW_Stub_Type) return Boolean
+   is
+      pragma Unreferenced (Left);
+      pragma Unreferenced (Right);
+   begin
+      return True;
+   end Same_Partition;
+
 end System.Partition_Interface;