2002-04-02 David S. Miller <davem@redhat.com>
[official-gcc.git] / gcc / ada / s-parint.adb
blob0344f48ae4fbabc2a140f404b507db3c190820e8
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 -- B o d y --
8 -- (Dummy body for non-distributed case) --
9 -- --
10 -- --
11 -- Copyright (C) 1995-2001 Free Software Foundation, Inc. --
12 -- --
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. --
23 -- --
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. --
30 -- --
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). --
33 -- --
34 ------------------------------------------------------------------------------
36 package body System.Partition_Interface is
38 pragma Warnings (Off); -- supress warnings for unreferenced formals
40 M : constant := 7;
42 type String_Access is access String;
44 -- To have a minimal implementation of U'Partition_ID.
46 type Pkg_Node;
47 type Pkg_List is access Pkg_Node;
48 type Pkg_Node is record
49 Name : String_Access;
50 Next : Pkg_List;
51 end record;
53 Pkg_Head : Pkg_List;
54 Pkg_Tail : Pkg_List;
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
66 procedure Check
67 (Name : in Unit_Name;
68 Version : in String;
69 RCI : in Boolean := True)
71 begin
72 null;
73 end Check;
75 -----------------------------
76 -- Get_Active_Partition_Id --
77 -----------------------------
79 function Get_Active_Partition_ID
80 (Name : Unit_Name)
81 return System.RPC.Partition_ID
83 P : Pkg_List := Pkg_Head;
84 N : String := Lower (Name);
86 begin
87 while P /= null loop
88 if P.Name.all = N then
89 return Get_Local_Partition_ID;
90 end if;
92 P := P.Next;
93 end loop;
95 return M;
96 end Get_Active_Partition_ID;
98 ------------------------
99 -- Get_Active_Version --
100 ------------------------
102 function Get_Active_Version
103 (Name : Unit_Name)
104 return String
106 begin
107 return "";
108 end Get_Active_Version;
110 ----------------------------
111 -- Get_Local_Partition_Id --
112 ----------------------------
114 function Get_Local_Partition_ID return System.RPC.Partition_ID is
115 begin
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
124 (Name : Unit_Name)
125 return System.RPC.Partition_ID
127 begin
128 return Get_Local_Partition_ID;
129 end Get_Passive_Partition_ID;
131 -------------------------
132 -- Get_Passive_Version --
133 -------------------------
135 function Get_Passive_Version
136 (Name : Unit_Name)
137 return String
139 begin
140 return "";
141 end Get_Passive_Version;
143 ------------------------------
144 -- Get_RCI_Package_Receiver --
145 ------------------------------
147 function Get_RCI_Package_Receiver
148 (Name : Unit_Name)
149 return Interfaces.Unsigned_64
151 begin
152 return 0;
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)
162 begin
163 null;
164 end Get_Unique_Remote_Pointer;
166 ------------
167 -- Launch --
168 ------------
170 procedure Launch
171 (Rsh_Command : in String;
172 Name_Is_Host : in Boolean;
173 General_Name : in String;
174 Command_Line : in String)
176 begin
177 null;
178 end Launch;
180 -----------
181 -- Lower --
182 -----------
184 function Lower (S : String) return String is
185 T : String := S;
187 begin
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'));
193 end if;
194 end loop;
196 return T;
197 end Lower;
199 ------------------------------------
200 -- Raise_Program_Error_For_E_4_18 --
201 ------------------------------------
203 procedure Raise_Program_Error_For_E_4_18 is
204 begin
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)
217 begin
218 Ada.Exceptions.Raise_Exception
219 (Program_Error'Identity, Ada.Exceptions.Exception_Message (E));
220 end Raise_Program_Error_Unknown_Tag;
222 --------------
223 -- RCI_Info --
224 --------------
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);
236 begin
237 while P /= null loop
238 if P.Name.all = N then
239 return Get_Local_Partition_ID;
240 end if;
242 P := P.Next;
243 end loop;
245 return M;
246 end Get_Active_Partition_ID;
248 ------------------------------
249 -- Get_RCI_Package_Receiver --
250 ------------------------------
252 function Get_RCI_Package_Receiver return Interfaces.Unsigned_64 is
253 begin
254 return 0;
255 end Get_RCI_Package_Receiver;
257 end RCI_Info;
259 ------------------------------
260 -- Register_Passive_Package --
261 ------------------------------
263 procedure Register_Passive_Package
264 (Name : in Unit_Name;
265 Version : in String := "")
267 begin
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 := "")
280 begin
281 if Pkg_Tail = null then
282 Pkg_Head := new Pkg_Node'(new String'(Lower (Name)), null);
283 Pkg_Tail := Pkg_Head;
285 else
286 Pkg_Tail.Next := new Pkg_Node'(new String'(Lower (Name)), null);
287 Pkg_Tail := Pkg_Tail.Next;
288 end if;
289 end Register_Receiving_Stub;
291 ---------
292 -- Run --
293 ---------
295 procedure Run
296 (Main : in Main_Subprogram_Type := null)
298 begin
299 if Main /= null then
300 Main.all;
301 end if;
302 end Run;
304 end System.Partition_Interface;