1 ------------------------------------------------------------------------------
3 -- GNAT RUN-TIME COMPONENTS --
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 --
8 -- (Dummy body for non-distributed case) --
11 -- Copyright (C) 1995-2001 Free Software Foundation, Inc. --
13 -- GNARL 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. GNARL 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 GNARL; see file COPYING. If not, write --
21 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
22 -- MA 02111-1307, USA. --
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. --
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). --
34 ------------------------------------------------------------------------------
36 package body System
.Partition_Interface
is
38 pragma Warnings
(Off
); -- supress warnings for unreferenced formals
42 type String_Access
is access String;
44 -- To have a minimal implementation of U'Partition_ID.
47 type Pkg_List
is access Pkg_Node
;
48 type Pkg_Node
is record
56 function getpid
return Integer;
57 pragma Import
(C
, getpid
);
59 PID
: constant Integer := getpid
;
61 function Lower
(S
: String) return String;
63 Passive_Prefix
: constant String := "SP__";
64 -- String prepended in top of shared passive packages
69 RCI
: in Boolean := True)
75 -----------------------------
76 -- Get_Active_Partition_Id --
77 -----------------------------
79 function Get_Active_Partition_ID
81 return System
.RPC
.Partition_ID
83 P
: Pkg_List
:= Pkg_Head
;
84 N
: String := Lower
(Name
);
88 if P
.Name
.all = N
then
89 return Get_Local_Partition_ID
;
96 end Get_Active_Partition_ID
;
98 ------------------------
99 -- Get_Active_Version --
100 ------------------------
102 function Get_Active_Version
108 end Get_Active_Version
;
110 ----------------------------
111 -- Get_Local_Partition_Id --
112 ----------------------------
114 function Get_Local_Partition_ID
return System
.RPC
.Partition_ID
is
116 return System
.RPC
.Partition_ID
(PID
mod M
);
117 end Get_Local_Partition_ID
;
119 ------------------------------
120 -- Get_Passive_Partition_ID --
121 ------------------------------
123 function Get_Passive_Partition_ID
125 return System
.RPC
.Partition_ID
128 return Get_Local_Partition_ID
;
129 end Get_Passive_Partition_ID
;
131 -------------------------
132 -- Get_Passive_Version --
133 -------------------------
135 function Get_Passive_Version
141 end Get_Passive_Version
;
143 ------------------------------
144 -- Get_RCI_Package_Receiver --
145 ------------------------------
147 function Get_RCI_Package_Receiver
149 return Interfaces
.Unsigned_64
153 end Get_RCI_Package_Receiver
;
155 -------------------------------
156 -- Get_Unique_Remote_Pointer --
157 -------------------------------
159 procedure Get_Unique_Remote_Pointer
160 (Handler
: in out RACW_Stub_Type_Access
)
164 end Get_Unique_Remote_Pointer
;
171 (Rsh_Command
: in String;
172 Name_Is_Host
: in Boolean;
173 General_Name
: in String;
174 Command_Line
: in String)
184 function Lower
(S
: String) return String is
188 for J
in T
'Range loop
189 if T
(J
) in 'A' .. 'Z' then
190 T
(J
) := Character'Val (Character'Pos (T
(J
)) -
191 Character'Pos ('A') +
192 Character'Pos ('a'));
199 ------------------------------------
200 -- Raise_Program_Error_For_E_4_18 --
201 ------------------------------------
203 procedure Raise_Program_Error_For_E_4_18
is
205 Ada
.Exceptions
.Raise_Exception
206 (Program_Error
'Identity,
207 "Illegal usage of remote access to class-wide type. See RM E.4(18)");
208 end Raise_Program_Error_For_E_4_18
;
210 -------------------------------------
211 -- Raise_Program_Error_Unknown_Tag --
212 -------------------------------------
214 procedure Raise_Program_Error_Unknown_Tag
215 (E
: in Ada
.Exceptions
.Exception_Occurrence
)
218 Ada
.Exceptions
.Raise_Exception
219 (Program_Error
'Identity, Ada
.Exceptions
.Exception_Message
(E
));
220 end Raise_Program_Error_Unknown_Tag
;
226 package body RCI_Info
is
228 -----------------------------
229 -- Get_Active_Partition_ID --
230 -----------------------------
232 function Get_Active_Partition_ID
return System
.RPC
.Partition_ID
is
233 P
: Pkg_List
:= Pkg_Head
;
234 N
: String := Lower
(RCI_Name
);
238 if P
.Name
.all = N
then
239 return Get_Local_Partition_ID
;
246 end Get_Active_Partition_ID
;
248 ------------------------------
249 -- Get_RCI_Package_Receiver --
250 ------------------------------
252 function Get_RCI_Package_Receiver
return Interfaces
.Unsigned_64
is
255 end Get_RCI_Package_Receiver
;
259 ------------------------------
260 -- Register_Passive_Package --
261 ------------------------------
263 procedure Register_Passive_Package
264 (Name
: in Unit_Name
;
265 Version
: in String := "")
268 Register_Receiving_Stub
(Passive_Prefix
& Name
, null, Version
);
269 end Register_Passive_Package
;
271 -----------------------------
272 -- Register_Receiving_Stub --
273 -----------------------------
275 procedure Register_Receiving_Stub
276 (Name
: in Unit_Name
;
277 Receiver
: in RPC
.RPC_Receiver
;
278 Version
: in String := "")
281 if Pkg_Tail
= null then
282 Pkg_Head
:= new Pkg_Node
'(new String'(Lower
(Name
)), null);
283 Pkg_Tail
:= Pkg_Head
;
286 Pkg_Tail
.Next
:= new Pkg_Node
'(new String'(Lower
(Name
)), null);
287 Pkg_Tail
:= Pkg_Tail
.Next
;
289 end Register_Receiving_Stub
;
296 (Main
: in Main_Subprogram_Type
:= null)
304 end System
.Partition_Interface
;