~ubuntu-branches/ubuntu/precise/topal/precise

« back to all changes in this revision

Viewing changes to expanding_array.ads

  • Committer: Bazaar Package Importer
  • Author(s): Phil Brooke
  • Date: 2008-07-18 07:57:38 UTC
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20080718075738-i1szqvmxz0evz32p
Tags: upstream-62
ImportĀ upstreamĀ versionĀ 62

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
--
2
 
--
3
 
--
4
 
--
 
1
-- Topal: GPG/GnuPG and Alpine/Pine integration
 
2
-- Copyright (C) 2001--2008  Phillip J. Brooke
 
3
--
 
4
-- This program is free software: you can redistribute it and/or modify
 
5
-- it under the terms of the GNU General Public License version 3 as
 
6
-- published by the Free Software Foundation.
 
7
--
 
8
-- This program is distributed in the hope that it will be useful,
 
9
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
-- GNU General Public License for more details.
 
12
--
 
13
-- You should have received a copy of the GNU General Public License
 
14
-- along with this program.  If not, see <http://www.gnu.org/licenses/>.
5
15
 
6
16
-- This package creates an instance of an array that expands.
7
17
 
 
18
with Ada.Finalization;
 
19
 
8
20
generic
9
21
   type Item is private;
10
22
package Expanding_Array is
50
49
   -- array size will be doubled until it is large enough.  So this call
51
50
   -- should never need to be explicitly used.
52
51
 
 
52
   Actual_Is_Null : exception;
 
53
 
53
54
private
54
55
 
55
56
   type Actual_Array is array (Positive range <>) of Item;
56
57
   type Actual_Array_Pointer is access Actual_Array;
57
58
 
58
 
   type Big_Array is record
 
59
   type Natural_Pointer is access all Natural;
 
60
   type Positive_Pointer is access all Positive;
 
61
 
 
62
   type Big_Array is new Ada.Finalization.Controlled
 
63
     with record
59
64
      Actual     : Actual_Array_Pointer;
60
 
      Array_Size : Positive;
61
 
   end record;
 
65
      Array_Size : Positive_Pointer;
 
66
      Ref_Count  : Natural_Pointer;
 
67
     end record;
 
68
   procedure Initialize (Object : in out Big_Array);
 
69
   procedure Adjust (Object : in out Big_Array);
 
70
   procedure Finalize (Object : in out Big_Array);
62
71
 
63
72
end Expanding_Array;