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) --
12 -- Copyright (C) 1995-2001 Free Software Foundation, Inc. --
14 -- GNARL is free software; you can redistribute it and/or modify it under --
15 -- terms of the GNU General Public License as published by the Free Soft- --
16 -- ware Foundation; either version 2, or (at your option) any later ver- --
17 -- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
18 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
19 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
20 -- for more details. You should have received a copy of the GNU General --
21 -- Public License distributed with GNARL; see file COPYING. If not, write --
22 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
23 -- MA 02111-1307, USA. --
25 -- As a special exception, if other files instantiate generics from this --
26 -- unit, or you link this unit with other files to produce an executable, --
27 -- this unit does not by itself cause the resulting executable to be --
28 -- covered by the GNU General Public License. This exception does not --
29 -- however invalidate any other reasons why the executable file might be --
30 -- covered by the GNU Public License. --
32 -- GNAT was originally developed by the GNAT team at New York University. --
33 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
35 ------------------------------------------------------------------------------
37 package body System.Partition_Interface is
39 pragma Warnings (Off); -- supress warnings for unreferenced formals
43 type String_Access is access String;
45 -- To have a minimal implementation of U'Partition_ID.
48 type Pkg_List is access Pkg_Node;
49 type Pkg_Node is record
57 function getpid return Integer;
58 pragma Import (C, getpid);
60 PID : constant Integer := getpid;
62 function Lower (S : String) return String;
64 Passive_Prefix : constant String := "SP__";
65 -- String prepended in top of shared passive packages
70 RCI : in Boolean := True)
76 -----------------------------
77 -- Get_Active_Partition_Id --
78 -----------------------------
80 function Get_Active_Partition_ID
82 return System.RPC.Partition_ID
84 P : Pkg_List := Pkg_Head;
85 N : String := Lower (Name);
89 if P.Name.all = N then
90 return Get_Local_Partition_ID;
97 end Get_Active_Partition_ID;
99 ------------------------
100 -- Get_Active_Version --
101 ------------------------
103 function Get_Active_Version
109 end Get_Active_Version;
111 ----------------------------
112 -- Get_Local_Partition_Id --
113 ----------------------------
115 function Get_Local_Partition_ID return System.RPC.Partition_ID is
117 return System.RPC.Partition_ID (PID mod M);
118 end Get_Local_Partition_ID;
120 ------------------------------
121 -- Get_Passive_Partition_ID --
122 ------------------------------
124 function Get_Passive_Partition_ID
126 return System.RPC.Partition_ID
129 return Get_Local_Partition_ID;
130 end Get_Passive_Partition_ID;
132 -------------------------
133 -- Get_Passive_Version --
134 -------------------------
136 function Get_Passive_Version
142 end Get_Passive_Version;
144 ------------------------------
145 -- Get_RCI_Package_Receiver --
146 ------------------------------
148 function Get_RCI_Package_Receiver
150 return Interfaces.Unsigned_64
154 end Get_RCI_Package_Receiver;
156 -------------------------------
157 -- Get_Unique_Remote_Pointer --
158 -------------------------------
160 procedure Get_Unique_Remote_Pointer
161 (Handler : in out RACW_Stub_Type_Access)
165 end Get_Unique_Remote_Pointer;
172 (Rsh_Command : in String;
173 Name_Is_Host : in Boolean;
174 General_Name : in String;
175 Command_Line : in String)
185 function Lower (S : String) return String is
189 for J in T'Range loop
190 if T (J) in 'A' .. 'Z' then
191 T (J) := Character'Val (Character'Pos (T (J)) -
192 Character'Pos ('A') +
193 Character'Pos ('a'));
200 ------------------------------------
201 -- Raise_Program_Error_For_E_4_18 --
202 ------------------------------------
204 procedure Raise_Program_Error_For_E_4_18 is
206 Ada.Exceptions.Raise_Exception
207 (Program_Error'Identity,
208 "Illegal usage of remote access to class-wide type. See RM E.4(18)");
209 end Raise_Program_Error_For_E_4_18;
211 -------------------------------------
212 -- Raise_Program_Error_Unknown_Tag --
213 -------------------------------------
215 procedure Raise_Program_Error_Unknown_Tag
216 (E : in Ada.Exceptions.Exception_Occurrence)
219 Ada.Exceptions.Raise_Exception
220 (Program_Error'Identity, Ada.Exceptions.Exception_Message (E));
221 end Raise_Program_Error_Unknown_Tag;
227 package body RCI_Info is
229 -----------------------------
230 -- Get_Active_Partition_ID --
231 -----------------------------
233 function Get_Active_Partition_ID return System.RPC.Partition_ID is
234 P : Pkg_List := Pkg_Head;
235 N : String := Lower (RCI_Name);
239 if P.Name.all = N then
240 return Get_Local_Partition_ID;
247 end Get_Active_Partition_ID;
249 ------------------------------
250 -- Get_RCI_Package_Receiver --
251 ------------------------------
253 function Get_RCI_Package_Receiver return Interfaces.Unsigned_64 is
256 end Get_RCI_Package_Receiver;
260 ------------------------------
261 -- Register_Passive_Package --
262 ------------------------------
264 procedure Register_Passive_Package
265 (Name : in Unit_Name;
266 Version : in String := "")
269 Register_Receiving_Stub (Passive_Prefix & Name, null, Version);
270 end Register_Passive_Package;
272 -----------------------------
273 -- Register_Receiving_Stub --
274 -----------------------------
276 procedure Register_Receiving_Stub
277 (Name : in Unit_Name;
278 Receiver : in RPC.RPC_Receiver;
279 Version : in String := "")
282 if Pkg_Tail = null then
283 Pkg_Head := new Pkg_Node'(new String'(Lower (Name)), null);
284 Pkg_Tail := Pkg_Head;
287 Pkg_Tail.Next := new Pkg_Node'(new String'(Lower (Name)), null);
288 Pkg_Tail := Pkg_Tail.Next;
290 end Register_Receiving_Stub;
297 (Main : in Main_Subprogram_Type := null)
305 end System.Partition_Interface;