DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

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 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ B T

⟦9dc50e97d⟧ TextFile

    Length: 6860 (0x1acc)
    Types: TextFile
    Names: »B«

Derivation

└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
    └─ ⟦129cab021⟧ »DATA« 
        └─⟦this⟧ 
└─⟦f64eaa120⟧ Bits:30000752 8mm tape, Rational 1000, !projects 93 02 16
    └─ ⟦6f12a12be⟧ »DATA« 
        └─⟦this⟧ 
└─⟦2f6cfab89⟧ Bits:30000547 8mm tape, Rational 1000, !projects 94-01-04
    └─ ⟦d65440be7⟧ »DATA« 
        └─⟦this⟧ 

TextFile

with Set_Generic;
with Signature;
with Parameter;
with String_Map_Generic;
with Text_Io;

use Text_Io;
package body Database is

    package Client_Set is new Set_Generic (Element => Natural);


    type Iterator_Implementation is new Client_Set.Iterator;




    subtype Set is Client_Set.Set;

    package Subs is new String_Map_Generic (Size => 100,
                                            Range_Type => Set,
                                            Ignore_Case => True);

    package Servers is
       new String_Map_Generic
              (Size => 100, Range_Type => Set, Ignore_Case => True);

    Subs_Map : Subs.Map;
    Servers_Map : Servers.Map;
    Status : Boolean;



    procedure Subscribe (Client : Natural; Method : Standard.Method.Object) is
        S : Set;
    begin

        Client_Set.Initialize (S);
        S := Subs.Eval (The_Map => Subs_Map,
                        D => Standard.Method.Image (Method));
        Client_Set.Add (S => S, X => Client);

        Subs.Define (The_Map => Subs_Map,
                     D => Standard.Method.Image (Method),
                     R => S,
                     Trap_Multiples => False);

    exception
        when Subs.Undefined =>
            Client_Set.Add (S => S, X => Client);

            Subs.Define (The_Map => Subs_Map,
                         D => Standard.Method.Image (Method),
                         R => S,
                         Trap_Multiples => True);
        when others =>
            raise;
    end Subscribe;



    procedure Unsubscribe (Client : Natural; Method : Standard.Method.Object) is
        S : Set;
    begin
        S := Subs.Eval (The_Map => Subs_Map,
                        D => Standard.Method.Image (Method));
        Client_Set.Delete (S => S, X => Client);

        Subs.Define (The_Map => Subs_Map,
                     D => Standard.Method.Image (Method),
                     R => S,
                     Trap_Multiples => False);

    exception
        when Subs.Undefined =>
            null;
        when others =>
            raise;
    end Unsubscribe;



    function Subscribers (Method : Standard.Method.Object) return Iterator is
        S : Set;  
        Iter : Client_Set.Iterator;
        Access_Iter : Iterator := new Iterator_Implementation;  
    begin
        S := Subs.Eval (The_Map => Subs_Map,
                        D => Standard.Method.Image (Method));
        Client_Set.Init (Iter, S);
        Access_Iter.all := Iterator_Implementation (Iter);
        return Access_Iter;
    exception
        when Subs.Undefined =>
            return null;
    end Subscribers;



    procedure Next (Iter : Iterator) is
    begin
        Client_Set.Next (Iter => Client_Set.Iterator (Iter.all));
    end Next;



    function Value (Iter : Iterator) return Natural is
    begin
        return Client_Set.Value (Client_Set.Iterator (Iter.all));
    end Value;



    function Is_Done (Iter : Iterator) return Boolean is
    begin  
        if Iter = null then
            return True;
        end if;

        return Client_Set.Done (Client_Set.Iterator (Iter.all));
    end Is_Done;



    procedure Publish (Server : Natural; Method : Standard.Method.Object) is
        S : Set;
    begin
        Client_Set.Initialize (S);
        S := Servers.Eval (The_Map => Servers_Map,
                           D => Standard.Method.Image (Method));
        Client_Set.Add (S => S, X => Server);

        Servers.Define (The_Map => Servers_Map,
                        D => Standard.Method.Image (Method),
                        R => S,
                        Trap_Multiples => False);
    exception
        when Servers.Undefined =>
            Client_Set.Add (S => S, X => Server);

            Servers.Define (The_Map => Servers_Map,
                            D => Standard.Method.Image (Method),
                            R => S,
                            Trap_Multiples => True);
        when others =>
            raise;
    end Publish;



    procedure Unpublish (Server : Natural; Method : Standard.Method.Object) is
        S : Set;
    begin
        S := Servers.Eval (The_Map => Servers_Map,
                           D => Standard.Method.Image (Method));
        Client_Set.Delete (S => S, X => Server);

        Servers.Define (The_Map => Servers_Map,
                        D => Standard.Method.Image (Method),
                        R => S,
                        Trap_Multiples => False);

    exception
        when Subs.Undefined =>
            null;
        when others =>
            raise;
    end Unpublish;



    function Publishers (Method : Standard.Method.Object) return Iterator is
        S : Set;  
        Iter : Client_Set.Iterator;
        Access_Iter : Iterator := new Iterator_Implementation;

        Stripped_Method : Standard.Method.Object;
    begin

        S := Servers.Eval (The_Map => Servers_Map,
                           D => Standard.Method.Image (Method));

        Client_Set.Init (Iter, S);
        Access_Iter.all := Iterator_Implementation (Iter);
        return Access_Iter;

    exception
        when Servers.Undefined =>

            Stripped_Method := Method;

            Standard.Method.Strip_Signature (Stripped_Method);

            declare
            begin
                S := Servers.Eval (The_Map => Servers_Map,
                                   D => Standard.Method.Image
                                           (Stripped_Method));

                Client_Set.Init (Iter, S);
                Access_Iter.all := Iterator_Implementation (Iter);
                return Access_Iter;
            exception
                when Servers.Undefined =>
                    return null;
                when others =>
                    raise;
            end;

        when others =>
            raise;
    end Publishers;



    procedure Expunge (Behavior : Natural) is
        Publishers_Iter : Servers.Iterator;
        Subscribers_Iter : Subs.Iterator;

        --[could be optimized by removing the call to Method.Value]

    begin

        Servers.Init (Iter => Publishers_Iter, The_Map => Servers_Map);
        Subs.Init (Iter => Subscribers_Iter, The_Map => Subs_Map);

        while not Servers.Done (Iter => Publishers_Iter) loop
            Unpublish (Server => Behavior,
                       Method => Method.Value
                                    (Servers.Value (Publishers_Iter)));

            Servers.Next (Iter => Publishers_Iter);
        end loop;


        while not Subs.Done (Iter => Subscribers_Iter) loop
            Unpublish (Server => Behavior,
                       Method => Method.Value (Subs.Value (Subscribers_Iter)));

            Subs.Next (Iter => Subscribers_Iter);
        end loop;

    end Expunge;


begin
    Subs.Initialize (The_Map => Subs_Map);
    Servers.Initialize (The_Map => Servers_Map);

end Database;