|
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 - download
Length: 16384 (0x4000) Types: Ada Source Notes: 03_class, FILE, R1k_Segment, e3_tag, generic, package String_Map, seg_005830
└─⟦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. ------------------------------------------------------------------------------ type Range_Type is private; ------------------------------------------------------------------------------ -- Range_Type - The data type to be stored within the map. This type must -- be constrained. ------------------------------------------------------------------------------ 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_Map is type Map is private; type Iter is private; ------------------------------------------------------------------------------ -- Map - Variables of this type are String Maps; ie. maps from string values -- to values of some Range_Type. -- 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 Range_Type values contained in the map are -- merely dropped and are not deallocated or manipulated in any way. ------------------------------------------------------------------------------ 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. ------------------------------------------------------------------------------ procedure Find (M : in Map; Key : in E_String; Rt : in out Range_Type; Success : out Boolean); ------------------------------------------------------------------------------ -- M - Specifies the map to use -- Key - Specifies the string value to use for the lookup -- Rt - Receives the Range_Type value from the map or is unchanged -- Success - Receives TRUE if the Key was found and FALSE if not -- -- Called to perform a lookup within the map. If the Key string is found -- within the map then the associated Range_Type value is returned and -- Success is set to TRUE. If the Key string is not found then Success is -- set to FALSE and the Rt parameter remains unchanged. (Beware of -- uninitialized locals being passed to Find; they will often be the cause -- of Constraint_Errors.) ------------------------------------------------------------------------------ function Locate (M : in Map; Key : in E_String) return Range_Type; ------------------------------------------------------------------------------ -- M - Specifies the map to use -- Key - Specifies the string value to use for the lookup -- -- Called to perform a lookup within the map. If the Key string is found -- within the map then the associated Range_Type value is returned. -- If the Key string is not found then Missing_Entry is raised. ------------------------------------------------------------------------------ procedure Insert (M : in Map; Key : in E_String; Rt : in Range_Type; Dups_Ok : in Boolean := False); ------------------------------------------------------------------------------ -- M - Specifies the map to use -- Key - Specifies the string value to use for the insertion -- Rt - Specifies the Range_Type value to be placed into the map -- Dups_Ok - Specifies TRUE if the new entry is allowed to replace an -- existing entry. -- -- Called to insert a new Range_Type value into the map. If Dups_Ok => FALSE -- then a preexisting map entry with the same Key value will cause -- Duplicate_Entry to be raised. ------------------------------------------------------------------------------ procedure Delete (M : in Map; Key : in E_String; Missing_Ok : in Boolean := False); ------------------------------------------------------------------------------ -- M - Specifies the map to use -- Key - Specifies the string value to use for the lookup -- Missing_Ok - Specifies TRUE if the entry need not exist -- -- Called to delete an existing Range_Type value from the map. Raises -- Missing_Entry if no matching Key entry is found unless Missing_Ok => TRUE. ------------------------------------------------------------------------------ procedure Remove (M : in Map; Key : in E_String; Rt : in out Range_Type; Success : out Boolean); ------------------------------------------------------------------------------ -- M - Specifies the map to use -- Key - Specifies the string value to use for the lookup -- Rt - Receives the Range_Type value from the map or is unchanged -- Success - Receives TRUE if the Key was found and FALSE if not -- -- Called to lookup and remove an entry within the map. If the Key string is -- found -- within the map then the associated Range_Type value is returned and -- Success is set to TRUE. If the Key string is not found then Success is -- set to FALSE and the Rt parameter remains unchanged. (Beware of -- uninitialized locals being passed to Find; they will often be the cause -- of Constraint_Errors.) ------------------------------------------------------------------------------ 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; -- Rt : Range_Type; -- begin -- Initilize (M, I); -- while not Done (I) loop -- Rt := Value (I); -- .... Code using the Rt 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 Values 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; ------------------------------------------------------------------------------ -- 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. ------------------------------------------------------------------------------ function Value (I : in Iter) return Range_Type; ------------------------------------------------------------------------------ -- I - Specifies the iterator to check -- -- Returns the Range_Type 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_Map;
nblk1=f nid=0 hdr6=1e [0x00] rec0=17 rec1=00 rec2=01 rec3=088 [0x01] rec0=12 rec1=00 rec2=02 rec3=034 [0x02] rec0=16 rec1=00 rec2=03 rec3=02c [0x03] rec0=00 rec1=00 rec2=0f rec3=004 [0x04] rec0=15 rec1=00 rec2=04 rec3=08e [0x05] rec0=00 rec1=00 rec2=0e rec3=004 [0x06] rec0=16 rec1=00 rec2=05 rec3=028 [0x07] rec0=11 rec1=00 rec2=06 rec3=088 [0x08] rec0=14 rec1=00 rec2=07 rec3=02c [0x09] rec0=13 rec1=00 rec2=08 rec3=018 [0x0a] rec0=11 rec1=00 rec2=09 rec3=056 [0x0b] rec0=1a rec1=00 rec2=0a rec3=004 [0x0c] rec0=13 rec1=00 rec2=0b rec3=060 [0x0d] rec0=1c rec1=00 rec2=0c rec3=01c [0x0e] rec0=09 rec1=00 rec2=0d rec3=000 tail 0x21700ab3081978ed32ab0 0x42a00088462063203