summaryrefslogtreecommitdiff
path: root/gcc/ada/s-shasto.ads
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2008-05-20 12:46:42 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2008-05-20 12:46:42 +0000
commiteb10ea32dcbb75bcfc7882b645a64aab17720476 (patch)
tree71c7f44038b908a0d6c4e52f839a9fa3e3c2ed25 /gcc/ada/s-shasto.ads
parentd54f6ec5353a384118649f31d83ece8aa1085d54 (diff)
downloadgcc-eb10ea32dcbb75bcfc7882b645a64aab17720476.tar.gz
2008-05-20 Kevin Pouget <pouget@adacore.com>
* exp_smem.ads, exp_smem.adb: Construction of access and assign routines has been replaced by an instantiation of System.Shared_Storage.Shared_Var_Procs generic package, while expanding shared variable declaration. Calls to access and assign routines have been replaced by calls to Read/Write routines of System.Shared_Storage.Shared_Var_Procs instantiated package. * rtsfind.ads: RE_Shared_Var_Procs entry has been added in RE_Unit_Table It identifies the new generic package added in s-shasto. * s-shasto.adb, s-shasto.ads: A new generic package has been added, it is instantiated for each shared passive variable. It provides supporting procedures called upon each read or write access by the expanded code. * sem_attr.adb: For this runtime unit (always compiled in GNAT mode), we allow stream attributes references for limited types for the case where shared passive objects are implemented using stream attributes, which is the default in GNAT's persistent storage implementation. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@135627 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/s-shasto.ads')
-rw-r--r--gcc/ada/s-shasto.ads65
1 files changed, 33 insertions, 32 deletions
diff --git a/gcc/ada/s-shasto.ads b/gcc/ada/s-shasto.ads
index fc4055b9826..8046fd5b2f6 100644
--- a/gcc/ada/s-shasto.ads
+++ b/gcc/ada/s-shasto.ads
@@ -79,48 +79,18 @@
-- The approach is as follows:
--- For each shared variable, var, an access routine varR is created whose
--- body has the following form (this example is for Pkg.Var):
-
--- procedure varR is
--- S : Ada.Streams.Stream_IO.Stream_Access;
--- begin
--- S := Shared_Var_ROpen ("pkg.var");
--- if S /= null then
--- typ'Read (S);
--- Shared_Var_Close (S);
--- end if;
--- end varR;
+-- For each shared variable, var, an instanciation of the below generic
+-- package is created which provides Read and Write supporting procedures.
-- The routine Shared_Var_ROpen in package System.Shared_Storage
-- either returns null if the storage does not exist, or otherwise a
-- Stream_Access value that references the corresponding shared
-- storage, ready to read the current value.
--- Each reference to the shared variable, var, is preceded by a
--- call to the corresponding varR procedure, which either leaves the
--- initial value unchanged if the storage does not exist, or reads
--- the current value from the shared storage.
-
--- In addition, for each shared variable, var, an assignment routine
--- is created whose body has the following form (again for Pkg.Var)
-
--- procedure VarA is
--- S : Ada.Streams.Stream_IO.Stream_Access;
--- begin
--- S := Shared_Var_WOpen ("pkg.var");
--- typ'Write (S, var);
--- Shared_Var_Close (S);
--- end VarA;
-
-- The routine Shared_Var_WOpen in package System.Shared_Storage
-- returns a Stream_Access value that references the corresponding
-- shared storage, ready to write the new value.
--- Each assignment to the shared variable, var, is followed by a call
--- to the corresponding varA procedure, which writes the new value to
--- the shared storage.
-
-- Note that there is no general synchronization for these storage
-- read and write operations, since it is assumed that a correctly
-- operating programs will provide appropriate synchronization. In
@@ -219,4 +189,35 @@ package System.Shared_Storage is
-- generated as the last operation in the body of a protected
-- subprogram.
+ -- This generic package is instantiated for each shared passive
+ -- variable. It provides supporting procedures called upon each
+ -- read or write access by the expanded code.
+
+ generic
+
+ type Typ is limited private;
+ -- Shared passive variable type
+
+ V : in out Typ;
+ -- Shared passive variable
+
+ Full_Name : String;
+ -- Shared passive variable storage name
+
+ package Shared_Var_Procs is
+
+ procedure Read;
+ -- Shared passive variable access routine. Each reference to the
+ -- shared variable, V, is preceded by a call to the corresponding
+ -- Read procedure, which either leaves the initial value unchanged
+ -- if the storage does not exist, or reads the current value from
+ -- the shared storage.
+
+ procedure Write;
+ -- Shared passive variable assignement routine. Each assignment to
+ -- the shared variable, V, is followed by a call to the corresponding
+ -- Write procedure, which writes the new value to the shared storage.
+
+ end Shared_Var_Procs;
+
end System.Shared_Storage;