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

⟦2861ebb67⟧ Ada Source

    Length: 14336 (0x3800)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Context, seg_0112a4, seg_01156d

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



package body Context is

    type Name_Pointer is access String;

    Null_Name : constant Name_Pointer := null;

    type Rule_Structure is
        record
            Name  : Name_Pointer;
            State : Boolean;
        end record;

    subtype Rule_Index       is Rule_Id range 1 .. Max_Rule;
    type    Rule_State_Array is array (Rule_Index) of Rule_Structure;

    type Context_Structure is
        record
            Name        : Name_Pointer;
            Rule_States : Rule_State_Array;
        end record;

    subtype Context_Index is Reference range 1 .. Max_Context;
    type    Contextes     is array (Context_Index) of Context_Structure;


    The_Contextes : Contextes :=
       (others => (Name        => Null_Name,
                   Rule_States => (others =>
                                      (Name => Null_Name, State => False))));

    Last_Reference : Context.Reference := 0;


    Unknown_Context : constant String := "CONTEXT_INCONNU";

------------------------------------------------------------------------------
    function Create (With_Name : String) return Context.Reference is
        The_Reference : Context.Reference := Context.Null_Reference;
    begin
        Context.Last_Reference              := Context.Last_Reference + 1;
        The_Contextes (Last_Reference).Name := new String'(With_Name);
        The_Reference                       := Last_Reference;
        return The_Reference;
    exception
        when Constraint_Error =>
            raise Context.Overflow;
    end Create;


------------------------------------------------------------------------------
    function Value (Of_Name : String) return Context.Reference is
        The_Reference : Context.Reference := Context.Null_Reference;
    begin
        for I in 1 .. Context.Last_Reference loop
            if The_Contextes (I).Name.all = Of_Name then
                The_Reference := I;
                exit;
            end if;
        end loop;
        return The_Reference;
    end Value;


------------------------------------------------------------------------------
    function Image (Of_Reference : Context.Reference) return String is
    begin
        if Of_Reference <= Context.Last_Reference and
           Of_Reference <= Max_Context and
           Of_Reference > Context.Null_Reference then
            return The_Contextes (Of_Reference).Name.all;
        else
            return Unknown_Context;
            -- raise Context.Illegal_Access;   --[???]
        end if;
    exception
        when Constraint_Error =>
            raise Context.Illegal_Access;
    end Image;


------------------------------------------------------------------------------
    procedure Add (In_Context : String;
                   The_Rule   : Context.Rule_Id;
                   With_Name  : String) is
        The_Context : Context.Reference :=
           Context.Value (Of_Name => In_Context);
    begin
        if The_Rule = Context.Null_Rule or The_Rule > Max_Rule then
            raise Bad_Rule;
        end if;
        if The_Context = Context.Null_Reference or
           The_Context > Max_Context then
            raise Bad_Context;
        end if;  
        The_Contextes (The_Context).Rule_States (The_Rule).Name  :=
           new String'(With_Name);
        The_Contextes (The_Context).Rule_States (The_Rule).State := False;
    end Add;

------------------------------------------------------------------------------
    procedure Add (In_Context : Context.Reference;
                   The_Rule   : Context.Rule_Id;
                   With_Name  : String) is
    begin
        if The_Rule = Context.Null_Rule or The_Rule > Max_Rule then
            raise Bad_Rule;
        end if;
        if In_Context = Context.Null_Reference or In_Context > Max_Context then
            raise Bad_Context;
        end if;  
        The_Contextes (In_Context).Rule_States (The_Rule).Name  :=
           new String'(With_Name);
        The_Contextes (In_Context).Rule_States (The_Rule).State := False;
    end Add;

------------------------------------------------------------------------------
    function Get (In_Context : String; The_Rule : Context.Rule_Id)
                 return String is
        The_Context : Context.Reference :=
           Context.Value (Of_Name => In_Context);
    begin
        if The_Rule = Context.Null_Rule or The_Rule > Max_Rule then
            raise Bad_Rule;
        end if;
        if The_Context = Context.Null_Reference or
           The_Context > Max_Context then
            raise Bad_Context;
        end if;
        return (The_Contextes (The_Context).Rule_States (The_Rule).Name.all);
    end Get;

------------------------------------------------------------------------------
    function Get (In_Context : Context.Reference; The_Rule : Context.Rule_Id)
                 return String is
    begin
        if The_Rule = Context.Null_Rule or The_Rule > Max_Rule then
            raise Bad_Rule;
        end if;
        if In_Context = Context.Null_Reference or In_Context > Max_Context then
            raise Bad_Context;
        end if;
        return (The_Contextes (In_Context).Rule_States (The_Rule).Name.all);
    end Get;

------------------------------------------------------------------------------
    function Is_Masked (In_Context : String; The_Rule : Context.Rule_Id)
                       return Boolean is
        The_Context : Context.Reference :=
           Context.Value (Of_Name => In_Context);
    begin
        if The_Rule = Context.Null_Rule or The_Rule > Max_Rule then
            raise Bad_Rule;
        end if;
        if The_Context = Context.Null_Reference or
           The_Context > Max_Context then
            raise Bad_Context;
        end if;
        return (The_Contextes (The_Context).Rule_States (The_Rule).State);
    end Is_Masked;

------------------------------------------------------------------------------
    function Is_Masked
                (In_Context : Context.Reference; The_Rule : Context.Rule_Id)
                return Boolean is
    begin
        if The_Rule = Context.Null_Rule or The_Rule > Max_Rule then
            raise Bad_Rule;
        end if;
        if In_Context = Context.Null_Reference or In_Context > Max_Context then
            raise Bad_Context;
        end if;
        return (The_Contextes (In_Context).Rule_States (The_Rule).State);
    end Is_Masked;


------------------------------------------------------------------------------
    procedure Mask (In_Context : String; The_Rule : Context.Rule_Id) is
        The_Context : Context.Reference :=
           Context.Value (Of_Name => In_Context);
    begin
        if The_Rule = Context.Null_Rule or The_Rule > Max_Rule then
            raise Bad_Rule;
        end if;
        if The_Context = Context.Null_Reference or
           The_Context > Max_Context then
            raise Bad_Context;
        end if;
        The_Contextes (The_Context).Rule_States (The_Rule).State := True;
    end Mask;

------------------------------------------------------------------------------
    procedure Mask (In_Context : Context.Reference;
                    The_Rule   : Context.Rule_Id) is
    begin
        if The_Rule = Context.Null_Rule or The_Rule > Max_Rule then
            raise Bad_Rule;
        end if;
        if In_Context = Context.Null_Reference or In_Context > Max_Context then
            raise Bad_Context;
        end if;
        The_Contextes (In_Context).Rule_States (The_Rule).State := True;
    end Mask;

------------------------------------------------------------------------------
    procedure Unmask (In_Context : String; The_Rule : Context.Rule_Id) is
        The_Context : Context.Reference :=
           Context.Value (Of_Name => In_Context);
    begin
        if The_Rule = Context.Null_Rule or The_Rule > Max_Rule then
            raise Bad_Rule;
        end if;
        if The_Context = Context.Null_Reference or
           The_Context > Max_Context then
            raise Bad_Context;
        end if;
        The_Contextes (The_Context).Rule_States (The_Rule).State := False;
    end Unmask;


------------------------------------------------------------------------------
    procedure Unmask (In_Context : Context.Reference;
                      The_Rule   : Context.Rule_Id) is
    begin
        if The_Rule = Context.Null_Rule or The_Rule > Max_Rule then
            raise Bad_Rule;
        end if;
        if In_Context = Context.Null_Reference or In_Context > Max_Context then
            raise Bad_Context;
        end if;
        The_Contextes (In_Context).Rule_States (The_Rule).State := False;
    end Unmask;



--============================================================================

begin
    Context.Last_Reference := 0;
    for I in Context_Index loop
        The_Contextes (I).Name := Null_Name;
        for J in Rule_Index loop
            The_Contextes (I).Rule_States (J).Name  := Null_Name;
            The_Contextes (I).Rule_States (J).State := False;
        end loop;
    end loop;

end Context;

E3 Meta Data

    nblk1=d
    nid=5
    hdr6=16
        [0x00] rec0=23 rec1=00 rec2=01 rec3=04e
        [0x01] rec0=16 rec1=00 rec2=0d rec3=034
        [0x02] rec0=1d rec1=00 rec2=08 rec3=048
        [0x03] rec0=03 rec1=00 rec2=09 rec3=010
        [0x04] rec0=17 rec1=00 rec2=06 rec3=078
        [0x05] rec0=19 rec1=00 rec2=03 rec3=012
        [0x06] rec0=19 rec1=00 rec2=07 rec3=006
        [0x07] rec0=17 rec1=00 rec2=02 rec3=064
        [0x08] rec0=19 rec1=00 rec2=04 rec3=01c
        [0x09] rec0=1d rec1=00 rec2=0b rec3=018
        [0x0a] rec0=0a rec1=00 rec2=0a rec3=000
        [0x0b] rec0=0b rec1=00 rec2=08 rec3=000
        [0x0c] rec0=0a rec1=40 rec2=00 rec3=000
    tail 0x2170cea1c82323b5dbcf5 0x42a00088462063c03
Free Block Chain:
  0x5: 0000  00 0c 03 fc 80 10 72 69 6e 67 20 20 20 20 20 20  ┆      ring      ┆
  0xc: 0000  00 00 00 0c 80 09 68 65 5f 52 65 66 65 72 65 09  ┆      he_Refere ┆