DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦a9495babe⟧ Ada Source

    Length: 4096 (0x1000)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Counters_A, seg_0488d1

Derivation

└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
    └─ ⟦5a81ac88f⟧ »Space Info Vol 1« 
        └─⟦this⟧ 

E3 Source Code



with Tree, String_Utilities, Unbounded_String;


package body Counters_A is

    package Identifier is new Unbounded_String (1);

    type Counter is
        record
            Name : Identifier.Variable_String;
            Value : Integer;
        end record;

---------------------

    function "<" (Left, Right : Counter) return Boolean is

    begin
        return String_Utilities.Less_Than
                  (Identifier.Image (Left.Name), Identifier.Image (Right.Name));
    end "<";

    function ">" (Left, Right : Counter) return Boolean is

    begin
        return String_Utilities.Greater_Than
                  (Identifier.Image (Left.Name), Identifier.Image (Right.Name));
    end ">";

    package Counter_Tree is new Tree (Element => Counter,
                                      Nb_Preallocation_Node => 10);

---------------------

    procedure Create (Name : String; Value : Integer := 0) is
        The_Counter : Counter;
    begin
        The_Counter.Name := Identifier.Value (Name);
        The_Counter.Value := Value;
        Counter_Tree.Insert (The_Counter);
    end Create;

    procedure Set_Value (Name : String; Value : Integer) is
        The_Counter : Counter;
    begin
        The_Counter.Name := Identifier.Value (Name);
        The_Counter.Value := Value;
        if Counter_Tree.Find (The_Counter) then
            Counter_Tree.Set_Current_Element (The_Counter);
        end if;
    end Set_Value;

    function Get_Value (Name : String) return Integer is
        The_Counter : Counter;
    begin
        The_Counter.Name := Identifier.Value (Name);
        if Counter_Tree.Find (The_Counter) then
            The_Counter := Counter_Tree.Get_Current_Element;
            return The_Counter.Value;
        end if;
    end Get_Value;

    function Exists (Name : String) return Boolean is
        The_Counter : Counter;
    begin  
        The_Counter.Name := Identifier.Value (Name);
        return Counter_Tree.Find (The_Counter);
    end Exists;

end Counters_A;

E3 Meta Data

    nblk1=3
    nid=0
    hdr6=6
        [0x00] rec0=25 rec1=00 rec2=01 rec3=03c
        [0x01] rec0=1e rec1=00 rec2=02 rec3=046
        [0x02] rec0=05 rec1=00 rec2=03 rec3=000
    tail 0x21545d2f6865a3ddeb5f6 0x42a00088462060003