| 1 |
------------------------------------------------------------------------------ |
| 2 |
-- -- |
| 3 |
-- GNAT COMPILER COMPONENTS -- |
| 4 |
-- -- |
| 5 |
-- E X P _ S T R M -- |
| 6 |
-- -- |
| 7 |
-- S p e c -- |
| 8 |
-- -- |
| 9 |
-- Copyright (C) 1992-2025, 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 |
-- Routines to build stream subprograms for composite types |
| 27 |
|
| 28 |
with Exp_Tss; use Exp_Tss; |
| 29 |
with Types; use Types; |
| 30 |
|
| 31 |
package Exp_Strm is |
| 32 |
|
| 33 |
function Build_Elementary_Input_Call (N : Node_Id) return Node_Id; |
| 34 |
-- Build call to Read attribute function for elementary type. Also used |
| 35 |
-- for Input attributes for elementary types with an appropriate extra |
| 36 |
-- assignment statement. N is the attribute reference node. |
| 37 |
|
| 38 |
function Build_Elementary_Write_Call (N : Node_Id) return Node_Id; |
| 39 |
-- Build call to Write attribute function for elementary type. Also used |
| 40 |
-- for Output attributes for elementary types (since the effect of the |
| 41 |
-- two attributes is identical for elementary types). N is the attribute |
| 42 |
-- reference node. |
| 43 |
|
| 44 |
function Build_Stream_Attr_Profile |
| 45 |
(Loc : Source_Ptr; |
| 46 |
Typ : Entity_Id; |
| 47 |
Nam : TSS_Name_Type) return List_Id; |
| 48 |
-- Builds the parameter profile for the stream attribute identified by |
| 49 |
-- the given name. This is used for the tagged case to build the spec |
| 50 |
-- for the primitive operation. |
| 51 |
|
| 52 |
-- The following routines build procedures and functions for stream |
| 53 |
-- attributes applied to composite types. For each of these routines, |
| 54 |
-- Loc is used to provide the location for the constructed subprogram |
| 55 |
-- declaration. Typ is the base type to which the subprogram applies |
| 56 |
-- (i.e. the base type of the stream attribute prefix). The returned |
| 57 |
-- results are the declaration and name (entity) of the subprogram. |
| 58 |
|
| 59 |
procedure Build_Array_Input_Function |
| 60 |
(Typ : Entity_Id; |
| 61 |
Decl : out Node_Id; |
| 62 |
Fnam : out Entity_Id); |
| 63 |
-- Build function for Input attribute for array type |
| 64 |
|
| 65 |
procedure Build_Array_Output_Procedure |
| 66 |
(Typ : Entity_Id; |
| 67 |
Decl : out Node_Id; |
| 68 |
Pnam : out Entity_Id); |
| 69 |
-- Build procedure for Output attribute for array type |
| 70 |
|
| 71 |
procedure Build_Array_Read_Procedure |
| 72 |
(Typ : Entity_Id; |
| 73 |
Decl : out Node_Id; |
| 74 |
Pnam : out Entity_Id); |
| 75 |
-- Build procedure for Read attribute for array type. |
| 76 |
|
| 77 |
procedure Build_Array_Write_Procedure |
| 78 |
(Typ : Entity_Id; |
| 79 |
Decl : out Node_Id; |
| 80 |
Pnam : out Entity_Id); |
| 81 |
-- Build procedure for Write attribute for array type. |
| 82 |
|
| 83 |
procedure Build_Mutable_Record_Read_Procedure |
| 84 |
(Typ : Entity_Id; |
| 85 |
Decl : out Node_Id; |
| 86 |
Pnam : out Entity_Id); |
| 87 |
-- Build procedure to Read a record with default discriminants. |
| 88 |
-- Discriminants must be read explicitly (RM 13.13.2(9)) in the |
| 89 |
-- same manner as is done for 'Input. |
| 90 |
|
| 91 |
procedure Build_Mutable_Record_Write_Procedure |
| 92 |
(Typ : Entity_Id; |
| 93 |
Decl : out Node_Id; |
| 94 |
Pnam : out Entity_Id); |
| 95 |
-- Build procedure to write a record with default discriminants. |
| 96 |
-- Discriminants must be written explicitly (RM 13.13.2(9)) in |
| 97 |
-- the same manner as is done for 'Output. |
| 98 |
|
| 99 |
procedure Build_Record_Or_Elementary_Input_Function |
| 100 |
(Typ : Entity_Id; |
| 101 |
Decl : out Node_Id; |
| 102 |
Fnam : out Entity_Id); |
| 103 |
-- Build function for Input attribute for record type or for an elementary |
| 104 |
-- type (the latter is used only in the case where a user-defined Read |
| 105 |
-- routine is defined, since, in other cases, Input calls the appropriate |
| 106 |
-- runtime library routine directly). |
| 107 |
|
| 108 |
procedure Build_Record_Or_Elementary_Output_Procedure |
| 109 |
(Typ : Entity_Id; |
| 110 |
Decl : out Node_Id; |
| 111 |
Pnam : out Entity_Id); |
| 112 |
-- Build procedure for Output attribute for record type or for an |
| 113 |
-- elementary type (the latter is used only in the case where a |
| 114 |
-- user defined Write routine is defined, since in other cases, |
| 115 |
-- Output calls the appropriate runtime library routine directly. |
| 116 |
|
| 117 |
procedure Build_Record_Read_Procedure |
| 118 |
(Typ : Entity_Id; |
| 119 |
Decl : out Node_Id; |
| 120 |
Pnam : out Entity_Id); |
| 121 |
-- Build procedure for Read attribute for record type |
| 122 |
|
| 123 |
procedure Build_Record_Write_Procedure |
| 124 |
(Typ : Entity_Id; |
| 125 |
Decl : out Node_Id; |
| 126 |
Pnam : out Entity_Id); |
| 127 |
-- Build procedure for Write attribute for record type |
| 128 |
|
| 129 |
procedure Build_Stream_Procedure |
| 130 |
(Typ : Entity_Id; |
| 131 |
Decl : out Node_Id; |
| 132 |
Pnam : Entity_Id; |
| 133 |
Stms : List_Id; |
| 134 |
Outp : Boolean); |
| 135 |
-- Called to build an array or record stream procedure. The first three |
| 136 |
-- arguments are the same as Build_Record_Or_Elementary_Output_Procedure. |
| 137 |
-- Stms is the list of statements for the body (the declaration list is |
| 138 |
-- always null), and Pnam is the name of the constructed procedure. |
| 139 |
-- Used by Exp_Dist to generate stream-oriented attributes for RACWs. |
| 140 |
|
| 141 |
end Exp_Strm; |