agpl_1.0.0_b5da3320/src/agpl-exceptions.adb

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package body Agpl.Exceptions is

   use Ada.Exceptions;

   --------------------------
   -- Protected_Occurrence --
   --------------------------

   protected body Protected_Occurrence is

      ---------------------
      -- Check_And_Clear --
      ---------------------

      procedure Check_And_Clear is
      begin
         if Exception_Identity (Occurrence) /= Null_Id then
            declare
               Temp : Exception_Occurrence;
            begin
               Save_Occurrence (Temp, Occurrence);
               Save_Occurrence (Occurrence, Null_Occurrence);
               Reraise_Occurrence (Temp);
            end;
         end if;
      end Check_And_Clear;

      ------------
      -- Is_Set --
      ------------

      function Is_Set return Boolean is
      begin
         return Exception_Identity (Occurrence) /= Null_Id;
      end Is_Set;

      -----------
      -- Clear --
      -----------

      procedure Clear is
      begin
         Save_Occurrence (Occurrence, Null_Occurrence);
      end Clear;

      -----------
      -- Store --
      -----------

      procedure Store (E : Ada.Exceptions.Exception_Occurrence) is
      begin
         Save_Occurrence (Occurrence, E);
      end Store;

   end Protected_Occurrence;

end Agpl.Exceptions;