OSDN Git Service

PR preprocessor/30805:
[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-2007, 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,  51  Franklin  Street,  Fifth  Floor, --
20 -- Boston, MA 02110-1301, 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 Ada.Streams;
39 with Interfaces;
40 with System.RPC;
41
42 package System.Partition_Interface is
43
44    pragma Elaborate_Body;
45
46    type DSA_Implementation_Name is (No_DSA, GARLIC_DSA, PolyORB_DSA);
47    DSA_Implementation : constant DSA_Implementation_Name := No_DSA;
48    --  Identification of this DSA implementation variant
49
50    PCS_Version : constant := 1;
51    --  Version of the PCS API (for Exp_Dist consistency check).
52    --  This version number is matched against Gnatvsn.PCS_Version_Number to
53    --  ensure that the versions of Exp_Dist and the PCS are consistent.
54
55    --  RCI receiving stubs contain a table of descriptors for
56    --  all user subprograms exported by the unit.
57
58    type Subprogram_Id is new Natural;
59    First_RCI_Subprogram_Id : constant := 2;
60
61    type RCI_Subp_Info is record
62       Addr : System.Address;
63       --  Local address of the proxy object
64    end record;
65
66    type RCI_Subp_Info_Access is access all RCI_Subp_Info;
67    type RCI_Subp_Info_Array is array (Integer range <>) of
68      aliased RCI_Subp_Info;
69
70    subtype Unit_Name is String;
71    --  Name of Ada units
72
73    type Main_Subprogram_Type is access procedure;
74
75    type RACW_Stub_Type is tagged record
76       Origin       : RPC.Partition_ID;
77       Receiver     : Interfaces.Unsigned_64;
78       Addr         : Interfaces.Unsigned_64;
79       Asynchronous : Boolean;
80    end record;
81
82    type RACW_Stub_Type_Access is access RACW_Stub_Type;
83    --  This type is used by the expansion to implement distributed objects.
84    --  Do not change its definition or its layout without updating
85    --  exp_dist.adb.
86
87    type RAS_Proxy_Type is tagged limited record
88       All_Calls_Remote : Boolean;
89       Receiver         : System.Address;
90       Subp_Id          : Subprogram_Id;
91    end record;
92
93    type RAS_Proxy_Type_Access is access RAS_Proxy_Type;
94    pragma No_Strict_Aliasing (RAS_Proxy_Type_Access);
95    --  This type is used by the expansion to implement distributed objects.
96    --  Do not change its definition or its layout without updating
97    --  Exp_Dist.Build_Remote_Supbrogram_Proxy_Type.
98
99    --  The Request_Access type is used for communication between the PCS
100    --  and the RPC receiver generated by the compiler: it contains all the
101    --  necessary information for the receiver to process an incoming call.
102
103    type RST_Access is access all Ada.Streams.Root_Stream_Type'Class;
104    type Request_Access is record
105       Params : RST_Access;
106       --  A stream describing the called subprogram and its parameters
107
108       Result : RST_Access;
109       --  A stream where the result, raised exception, or out values,
110       --  are marshalled.
111    end record;
112
113    procedure Check
114      (Name    : Unit_Name;
115       Version : String;
116       RCI     : Boolean := True);
117    --  Use by the main subprogram to check that a remote receiver
118    --  unit has has the same version than the caller's one.
119
120    function Same_Partition
121       (Left  : not null access RACW_Stub_Type;
122        Right : not null access RACW_Stub_Type) return Boolean;
123    --  Determine whether Left and Right correspond to objects instantiated
124    --  on the same partition, for enforcement of E.4(19).
125
126    function Get_Active_Partition_ID (Name : Unit_Name) return RPC.Partition_ID;
127    --  Similar in some respects to RCI_Locator.Get_Active_Partition_ID
128
129    function Get_Active_Version (Name : Unit_Name) return String;
130    --  Similar in some respects to Get_Active_Partition_ID
131
132    function Get_Local_Partition_ID return RPC.Partition_ID;
133    --  Return the Partition_ID of the current partition
134
135    function Get_Passive_Partition_ID
136      (Name : Unit_Name) return RPC.Partition_ID;
137    --  Return the Partition_ID of the given shared passive partition
138
139    function Get_Passive_Version (Name : Unit_Name) return String;
140    --  Return the version corresponding to a shared passive unit
141
142    function Get_RCI_Package_Receiver
143      (Name : Unit_Name) return Interfaces.Unsigned_64;
144    --  Similar in some respects to RCI_Locator.Get_RCI_Package_Receiver
145
146    procedure Get_Unique_Remote_Pointer
147      (Handler : in out RACW_Stub_Type_Access);
148    --  Get a unique pointer on a remote object
149
150    procedure Raise_Program_Error_Unknown_Tag
151      (E : Ada.Exceptions.Exception_Occurrence);
152    pragma No_Return (Raise_Program_Error_Unknown_Tag);
153    --  Raise Program_Error with the same message as E one
154
155    type RPC_Receiver is access procedure (R : Request_Access);
156    procedure Register_Receiving_Stub
157      (Name          : Unit_Name;
158       Receiver      : RPC_Receiver;
159       Version       : String := "";
160       Subp_Info     : System.Address;
161       Subp_Info_Len : Integer);
162    --  Register the fact that the Name receiving stub is now elaborated.
163    --  Register the access value to the package RPC_Receiver procedure.
164
165    procedure Get_RAS_Info
166      (Name          :  Unit_Name;
167       Subp_Id       :  Subprogram_Id;
168       Proxy_Address : out Interfaces.Unsigned_64);
169    --  Look up the address of the proxy object for the given subprogram
170    --  in the named unit, or Null_Address if not present on the local
171    --  partition.
172
173    procedure Register_Passive_Package
174      (Name    : Unit_Name;
175       Version : String := "");
176    --  Register a passive package
177
178    generic
179       RCI_Name : String;
180       Version  : String;
181    package RCI_Locator is
182       pragma Unreferenced (Version);
183
184       function Get_RCI_Package_Receiver return Interfaces.Unsigned_64;
185       function Get_Active_Partition_ID return RPC.Partition_ID;
186    end RCI_Locator;
187    --  RCI package information caching
188
189    procedure Run (Main : Main_Subprogram_Type := null);
190    --  Run the main subprogram
191
192 end System.Partition_Interface;