OSDN Git Service

2004-09-09 Vincent Celier <celier@gnat.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / s-parint.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT RUN-TIME COMPONENTS                         --
4 --                                                                          --
5 --            S Y S T E M . P A R T I T I O N _ I N T E R F A C E           --
6 --                                                                          --
7 --                                  S p e c                                 --
8 --                                                                          --
9 --          Copyright (C) 1995-2004 Free Software Foundation, Inc.          --
10 --                                                                          --
11 -- GNARL is free software; you can  redistribute it  and/or modify it under --
12 -- terms of the  GNU General Public License as published  by the Free Soft- --
13 -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
14 -- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
17 -- for  more details.  You should have  received  a copy of the GNU General --
18 -- Public License  distributed with GNARL; see file COPYING.  If not, write --
19 -- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
20 -- MA 02111-1307, USA.                                                      --
21 --                                                                          --
22 -- As a special exception,  if other files  instantiate  generics from this --
23 -- unit, or you link  this unit with other files  to produce an executable, --
24 -- this  unit  does not  by itself cause  the resulting  executable  to  be --
25 -- covered  by the  GNU  General  Public  License.  This exception does not --
26 -- however invalidate  any other reasons why  the executable file  might be --
27 -- covered by the  GNU Public License.                                      --
28 --                                                                          --
29 -- GNAT was originally developed  by the GNAT team at  New York University. --
30 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
31 --                                                                          --
32 ------------------------------------------------------------------------------
33
34 --  This unit may be used directly from an application program by providing
35 --  an appropriate WITH, and the interface can be expected to remain stable.
36
37 with Ada.Exceptions;
38 with Interfaces;
39 with System.RPC;
40
41 package System.Partition_Interface is
42
43    pragma Elaborate_Body;
44
45    type DSA_Implementation_Name is (No_DSA, GLADE_DSA, PolyORB_DSA);
46    DSA_Implementation : constant DSA_Implementation_Name := No_DSA;
47
48    --  RCI receiving stubs contain a table of descriptors for
49    --  all user subprograms exported by the unit.
50
51    type Subprogram_Id is new Natural;
52    First_RCI_Subprogram_Id : constant := 2;
53
54    type RCI_Subp_Info is record
55       Addr : System.Address;
56       --  Local address of the proxy object
57    end record;
58
59    type RCI_Subp_Info_Access is access all RCI_Subp_Info;
60    type RCI_Subp_Info_Array is array (Integer range <>) of
61      aliased RCI_Subp_Info;
62
63    subtype Unit_Name is String;
64    --  Name of Ada units
65
66    type Main_Subprogram_Type is access procedure;
67
68    type RACW_Stub_Type is tagged record
69       Origin       : RPC.Partition_ID;
70       Receiver     : Interfaces.Unsigned_64;
71       Addr         : Interfaces.Unsigned_64;
72       Asynchronous : Boolean;
73    end record;
74
75    type RACW_Stub_Type_Access is access RACW_Stub_Type;
76    --  This type is used by the expansion to implement distributed objects.
77    --  Do not change its definition or its layout without updating
78    --  exp_dist.adb.
79
80    type RAS_Proxy_Type is tagged limited record
81       All_Calls_Remote : Boolean;
82       Receiver         : System.Address;
83       Subp_Id          : Subprogram_Id;
84    end record;
85
86    type RAS_Proxy_Type_Access is access RAS_Proxy_Type;
87    pragma No_Strict_Aliasing (RAS_Proxy_Type_Access);
88    --  This type is used by the expansion to implement distributed objects.
89    --  Do not change its definition or its layout without updating
90    --  Exp_Dist.Build_Remote_Supbrogram_Proxy_Type.
91
92    procedure Check
93      (Name    : Unit_Name;
94       Version : String;
95       RCI     : Boolean := True);
96    --  Use by the main subprogram to check that a remote receiver
97    --  unit has has the same version than the caller's one.
98
99    function Get_Active_Partition_ID (Name : Unit_Name) return RPC.Partition_ID;
100    --  Similar in some respects to RCI_Info.Get_Active_Partition_ID
101
102    function Get_Active_Version (Name : Unit_Name) return String;
103    --  Similar in some respects to Get_Active_Partition_ID
104
105    function Get_Local_Partition_ID return RPC.Partition_ID;
106    --  Return the Partition_ID of the current partition
107
108    function Get_Passive_Partition_ID
109      (Name : Unit_Name) return RPC.Partition_ID;
110    --  Return the Partition_ID of the given shared passive partition
111
112    function Get_Passive_Version (Name : Unit_Name) return String;
113    --  Return the version corresponding to a shared passive unit
114
115    function Get_RCI_Package_Receiver
116      (Name : Unit_Name) return Interfaces.Unsigned_64;
117    --  Similar in some respects to RCI_Info.Get_RCI_Package_Receiver
118
119    procedure Get_Unique_Remote_Pointer
120      (Handler : in out RACW_Stub_Type_Access);
121    --  Get a unique pointer on a remote object
122
123    procedure Raise_Program_Error_Unknown_Tag
124      (E : Ada.Exceptions.Exception_Occurrence);
125    pragma No_Return (Raise_Program_Error_Unknown_Tag);
126    --  Raise Program_Error with the same message as E one
127
128    procedure Register_Receiving_Stub
129      (Name          : Unit_Name;
130       Receiver      : RPC.RPC_Receiver;
131       Version       : String := "";
132       Subp_Info     : System.Address;
133       Subp_Info_Len : Integer);
134    --  Register the fact that the Name receiving stub is now elaborated.
135    --  Register the access value to the package RPC_Receiver procedure.
136
137    procedure Get_RAS_Info
138      (Name          :  Unit_Name;
139       Subp_Id       :  Subprogram_Id;
140       Proxy_Address : out Interfaces.Unsigned_64);
141    --  Look up the address of the proxy object for the given subprogram
142    --  in the named unit, or Null_Address if not present on the local
143    --  partition.
144
145    procedure Register_Passive_Package
146      (Name    : Unit_Name;
147       Version : String := "");
148    --  Register a passive package
149
150    generic
151       RCI_Name : String;
152    package RCI_Info is
153       function Get_RCI_Package_Receiver return Interfaces.Unsigned_64;
154       function Get_Active_Partition_ID return RPC.Partition_ID;
155    end RCI_Info;
156    --  RCI package information caching
157
158    procedure Run (Main : Main_Subprogram_Type := null);
159    --  Run the main subprogram
160
161 end System.Partition_Interface;