|
|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 10240 (0x2800)
Types: Ada Source
Notes: 03_class, FILE, R1k_Segment, e3_tag, generic, package String_Heap, seg_00582e
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
└─⟦cfc2e13cd⟧ »Space Info Vol 2«
└─⟦this⟧
with Arithmetic;
use Arithmetic;
with Vstring_Type;
use Vstring_Type;
generic
------------------------------------------------------------------------------
-- Copyright 1989 - 1991 by Rational, Santa Clara, California.
--
-- All Rights Reserved.
--
-- Permission to use, copy, modify, and distribute this software and its
-- documentation for any purpose and without fee is hereby granted,
-- provided that the above copyright notice(s) appear in all copies and that
-- both that copyright notice(s) and this permission notice appear in
-- supporting documentation, and that the name of Rational not be used in
-- advertising or publicity pertaining to distribution of the software
-- without specific, written prior permission.
--
-- Rational disclaims all warranties with regard to this software, including
-- all implied warranties of merchantability and fitness, in no event shall
-- Rational be liable for any special, indirect or consequential damages or
-- any damages whatsoever resulting from loss of use, data or profits, whether
-- in an action of contract, negligence or other tortious action, arising out
-- of or in connection with the use or performance of this software.
------------------------------------------------------------------------------
Hash_Size : S_Positive := 13;
------------------------------------------------------------------------------
-- Specifies the size of the hash table used. The value should always be
-- a prime number and should be "large enough" to allow for "good" hash table
-- performance.
-- 13, 31, 59, 101, 211, 307, 401, 503, 751, 1009, 1511, 2003, 3001, 4001,
-- 5003, 6007, 7001, 8009, 9001, 10007, 15013, 20011, 30011, 40009, 50021
------------------------------------------------------------------------------
Exact_Case_Match : Boolean := True;
------------------------------------------------------------------------------
-- Specifies TRUE if "A" matches "A" but not "a".
------------------------------------------------------------------------------
package String_Heap is
type Map is private;
type Iter is private;
------------------------------------------------------------------------------
-- Map - Variables of this type are String Heaps; ie. shared collections of
-- string values allocated upon the heap
-- Iter - Variables of this type are used to iterate through all entries
-- within a map.
------------------------------------------------------------------------------
None_Map : constant Map;
None_Iter : constant Iter;
------------------------------------------------------------------------------
-- Uninitialized values.
------------------------------------------------------------------------------
Duplicate_Entry : exception;
Missing_Entry : exception;
------------------------------------------------------------------------------
-- Duplicate_Entry - raised by Insert when duplicate keys conflict
-- Missing_Entry - raised by Delete/Locate when a key is missing
------------------------------------------------------------------------------
procedure New_Map (M : out Map);
------------------------------------------------------------------------------
-- M - Receives a new Map.
--
-- Called to create and initialize a new Map. The Map Is_Empty.
------------------------------------------------------------------------------
procedure Free_Map (M : in out Map);
------------------------------------------------------------------------------
-- M - Specifies the existing Map to deallocate.
--
-- Called to destroy an existing Map. Map may have a None_Map value. All map
-- entries are destroyed. The pointer values contained in the map are
-- are deallocated using Unchecked_Deallocation.
------------------------------------------------------------------------------
function Is_Empty (M : in Map) return Boolean;
------------------------------------------------------------------------------
-- M - Specifies the map
--
-- Returns TRUE if the map is completely empty.
------------------------------------------------------------------------------
function Cardinality (M : in Map) return S_Natural;
------------------------------------------------------------------------------
-- M - Specifies the map
--
-- Returns the number of entries in the map.
------------------------------------------------------------------------------
function Share (M : in Map;
Key : in E_String) return E_String_Pointer;
------------------------------------------------------------------------------
-- M - Specifies the map to use
-- Key - Specifies the string value to use for the lookup
--
-- Returns a shared string containing the same characters as are found in Key.
------------------------------------------------------------------------------
procedure Initialize (M : in Map;
I : in out Iter);
------------------------------------------------------------------------------
-- M - Specifies the map
-- I - Receives the new iteration value
--
-- Called to initialize an iterator for a particular map. Iterators are
-- used in this fashion:
-- declare
-- I : Iter;
-- M : Map;
-- Vl : E_String_Pointer;
-- begin
-- Initilize (M, I);
-- while not Done (I) loop
-- Vl := key (I);
-- .... Code using the Vl value ....
-- Next (I);
-- end loop;
-- end;
-- Iterators are affected by changes to the map. Deletions can cause
-- dereferencing of null pointers. Insertions are benign and new map entries
-- may or may not appear as Keys in the iteration depending upon the
-- state of the Iter when the Insert is performed and also depending upon the
-- value of the Key string.
--
-- The iterator will advance through all entries within the map and the
-- processing order of the entries is determined by the hash value of the
-- Key strings and may or may not have any externally sensible ordering.
------------------------------------------------------------------------------
function Done (I : in Iter) return Boolean;
------------------------------------------------------------------------------
-- I - Specifies the iterator to check
--
-- Returns TRUE when there are no more map entries to iterate through.
------------------------------------------------------------------------------
function Key (I : in Iter) return E_String_Pointer;
------------------------------------------------------------------------------
-- I - Specifies the iterator to check
--
-- Returns the key string value associated with the current value of the
-- map iterator. Raises Missing_Entry if Done(I) = TRUE.
------------------------------------------------------------------------------
procedure Next (I : in out Iter);
------------------------------------------------------------------------------
-- I - Specifies the iterator
--
-- Advances the map iterator by one entry. Raises Missing_Entry if
-- Done(I) = TRUE already. Done(I) = TRUE will be true when this routine
-- returns if there are no more entries to be processed.
------------------------------------------------------------------------------
--\x0c
private
type Map_Rec;
type Elem_Rec;
type Element is access Elem_Rec;
type Map is access Map_Rec;
None_Map : constant Map := null;
type Iter is
record
M : Map := null;
Elem : Element := null;
Index : S_Natural := 0;
end record;
None_Iter : constant Iter := (null, null, 0);
end String_Heap;
nblk1=9
nid=0
hdr6=12
[0x00] rec0=17 rec1=00 rec2=01 rec3=088
[0x01] rec0=11 rec1=00 rec2=02 rec3=050
[0x02] rec0=17 rec1=00 rec2=03 rec3=062
[0x03] rec0=00 rec1=00 rec2=09 rec3=008
[0x04] rec0=15 rec1=00 rec2=04 rec3=022
[0x05] rec0=16 rec1=00 rec2=05 rec3=024
[0x06] rec0=19 rec1=00 rec2=06 rec3=004
[0x07] rec0=13 rec1=00 rec2=07 rec3=060
[0x08] rec0=1f rec1=00 rec2=08 rec3=000
tail 0x21700ab2c81978ecaff0a 0x42a00088462063203