OSDN Git Service

2007-09-26 Thomas Quinot <quinot@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / exp_dist.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --                             E X P _ D I S T                              --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --          Copyright (C) 1992-2007, Free Software Foundation, Inc.         --
10 --                                                                          --
11 -- GNAT 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 3,  or (at your option) any later ver- --
14 -- sion.  GNAT 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 GNAT; see file COPYING3.  If not, go to --
19 -- http://www.gnu.org/licenses for a complete copy of the license.          --
20 --                                                                          --
21 -- GNAT was originally developed  by the GNAT team at  New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
23 --                                                                          --
24 ------------------------------------------------------------------------------
25
26 --  This package contains utility routines used for the generation of the
27 --  stubs relevant to the distribution annex.
28
29 with Namet; use Namet;
30 with Types; use Types;
31
32 package Exp_Dist is
33
34    PCS_Version_Number : constant := 1;
35    --  PCS interface version. This is used to check for consistency between the
36    --  compiler used to generate distribution stubs and the PCS implementation.
37    --  It must be incremented whenever a change is made to the generated code
38    --  for distribution stubs that would result in the compiler being
39    --  incompatible with an older version of the PCS, or vice versa.
40
41    procedure Add_RAST_Features (Vis_Decl : Node_Id);
42    --  Build and add bodies for dereference and 'Access subprograms for a
43    --  remote access to subprogram type. Vis_Decl is the declaration node for
44    --  the RAS type.
45
46    procedure Add_RACW_Features (RACW_Type : Entity_Id);
47    --  Add RACW features. If the RACW and the designated type are not in the
48    --  same scope, then Add_RACW_Primitive_Declarations_And_Bodies is called
49    --  automatically since we do know the primitive list already.
50
51    procedure Add_RACW_Primitive_Declarations_And_Bodies
52      (Designated_Type : Entity_Id;
53       Insertion_Node  : Node_Id;
54       Body_Decls      : List_Id);
55    --  Add primitive for the stub type, and the RPC receiver. The declarations
56    --  are inserted after insertion_Node, while the bodies are appened at the
57    --  end of Decls.
58
59    procedure Remote_Types_Tagged_Full_View_Encountered
60      (Full_View : Entity_Id);
61    --  When a full view with a private view is encountered in a Remote_Types
62    --  package and corresponds to a tagged type, then this procedure is called
63    --  to generate the needed RACW features if it is needed.
64
65    procedure RACW_Type_Is_Asynchronous (RACW_Type : Entity_Id);
66    --  This subprogram must be called when it is detected that the RACW type
67    --  is asynchronous.
68
69    procedure Expand_Calling_Stubs_Bodies (Unit_Node : Node_Id);
70    --  Call the expansion phase for the calling stubs. The code will be added
71    --  at the end of the compilation unit, which is a package spec.
72
73    procedure Expand_Receiving_Stubs_Bodies (Unit_Node : Node_Id);
74    --  Call the expansion phase for the calling stubs. The code will be added
75    --  at the end of the compilation unit, which may be either a package spec
76    --  or a package body.
77
78    procedure Expand_All_Calls_Remote_Subprogram_Call (N : Node_Id);
79    --  Rewrite a call to a subprogram located in a Remote_Call_Interface
80    --  package on which the pragma All_Calls_Remote applies so that it
81    --  goes through the PCS. N is either an N_Procedure_Call_Statement
82    --  or an N_Function_Call node.
83
84    procedure Build_Passive_Partition_Stub (U : Node_Id);
85    --  Build stub for a shared passive package. U is the analyzed
86    --  compilation unit for a package declaration.
87
88    function Build_Subprogram_Id
89      (Loc : Source_Ptr;
90       E   : Entity_Id) return Node_Id;
91    --  Build a literal representing the remote subprogram identifier of E
92
93    function Copy_Specification
94      (Loc         : Source_Ptr;
95       Spec        : Node_Id;
96       Ctrl_Type   : Entity_Id := Empty;
97       New_Name    : Name_Id   := No_Name) return Node_Id;
98    --  Build a subprogram specification from another one, or from an
99    --  access-to-subprogram definition. If Ctrl_Type is not Empty, and any
100    --  controlling formal of an anonymous access type is found, then it is
101    --  replaced by an access to Ctrl_Type. If New_Name is given, then it will
102    --  be used as the name for the newly created spec.
103
104    function Corresponding_Stub_Type (RACW_Type : Entity_Id) return Entity_Id;
105    --  Return the stub type associated with the given RACW type
106
107    function Underlying_RACW_Type (RAS_Typ : Entity_Id) return Entity_Id;
108    --  Given a remote access-to-subprogram type or its equivalent
109    --  record type, return the RACW type generated to implement it.
110
111    procedure Append_RACW_Bodies (Decls : List_Id; Spec_Id : Entity_Id);
112    --  Append the unanalyzed subprogram bodies generated to support RACWs
113    --  declared in the given package spec (RACW stream subprograms, calling
114    --  stubs primitive operations) to the given list (which is expected to be
115    --  the declarations list for the corresponding package body, if there is
116    --  one). In the case where a body is present, the subprogram bodies must
117    --  not be generated in the package spec because this would cause an
118    --  incorrect attempt to freeze Taft amendment types declared in the spec.
119
120    function Make_Transportable_Check
121      (Loc  : Source_Ptr;
122       Expr : Node_Id) return Node_Id;
123    --  Generate a check that the given expression (an actual in a remote
124    --  subprogram call, or the return value of a function in the context of
125    --  a remote call) satisfies the requirements for being transportable
126    --  across partitions, raising Program_Error if it does not.
127
128 end Exp_Dist;