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

⟦a8f677688⟧ TextFile

    Length: 9036 (0x234c)
    Types: TextFile
    Names: »B«

Derivation

└─⟦149519bd4⟧ Bits:30000546 8mm tape, Rational 1000, !projects 93-07-13
    └─ ⟦124ff5788⟧ »DATA« 
        └─⟦this⟧ 
└─⟦f64eaa120⟧ Bits:30000752 8mm tape, Rational 1000, !projects 93 02 16
    └─ ⟦6f12a12be⟧ »DATA« 
        └─⟦this⟧ 

TextFile

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;